国家不回复表格?

I asked this is another forum a few weeks ago and no one was able to answer it, hoping someone here could. The state chosen goes to the database, but when the page is refreshed, it only shows select and not the state. Same goes with the the gender but gender doesn't even post in the database.

<?php

    if( !isset( $_SESSION ) ){

        session_start();

    }


    $con=mysqli_connect("localhost", "root", "", "test");

    // Check connection

    if (mysqli_connect_errno()) {

      echo "Failed to connect to MySQL: " . mysqli_connect_error();

    }

    // escape variables for security

    $firstname = mysqli_real_escape_string($con, $_POST['firstname']);
    $lastname = mysqli_real_escape_string($con, $_POST['lastname']);
    $gender = mysqli_real_escape_string($con, $_POST['gender']);
    $number = mysqli_real_escape_string($con, $_POST['number']);
    $email = mysqli_real_escape_string($con, $_POST['email']);
    $addressone = mysqli_real_escape_string($con, $_POST['addressone']);
    $addresstwo = mysqli_real_escape_string($con, $_POST['addresstwo']);
    $city = mysqli_real_escape_string($con, $_POST['city']);
    $state = mysqli_real_escape_string($con, $_POST['state']); 
    $zip = mysqli_real_escape_string($con, $_POST['zip']);


     $sql="UPDATE users SET firstname='$firstname', lastname = '$lastname', gender = '$gender,'number='$number', email = '$email',addressone='$addressone', addresstwo= '$addresstwo',`city`='$city', state = '$state', zip = '$zip' WHERE id='" .$_SESSION['id']."'";



    if (!mysqli_query($con,$sql)) {

      die('Error: ' . mysqli_error($con));
    }
    header("Location:dashboard.php");

    mysqli_close($con);

?>




Part of the entire form

<div class="form-group">
            <label class="col-md-5 control-label" name="state">State</label>
                <div class="col-md-2">
                    <select id="state" name="state" class="form-control" value="<?php echo $state; ?>">
                        <option>Select</option>
                        <option>Alabama</option>
                        <option>Alaska</option>
                        <option>Arizona</option>
                        <option>Arkansas</option>
                        <option>California</option>
                        <option>Colorado</option>
                        <option>Connecticut</option>
                        <option>Delaware</option>
                        <option>District of Colombia</option>
                        <option>Florida</option>
                        <option>Georgia</option>
                        <option>Hawaii</option>
                        <option>Idaho</option>
                        <option>Illinois</option>
                        <option>Indiana</option>
                        <option>Iowa</option>
                        <option>Kansas</option>
                        <option>Kentucky</option>
                        <option>Louisiana</option>
                        <option>Maine</option>
                        <option>Maryland</option>
                        <option>Massachusetts</option>
                        <option>Michigan</option>
                        <option>Minnesota</option>
                        <option>Mississippi</option>
                        <option>Missouri</option>
                        <option>Montana</option>
                        <option>Nebraska</option>
                        <option>Nevada</option>
                        <option>New Hampshire</option>
                        <option>New Jersey</option>
                        <option>New Mexico</option>
                        <option>New York</option>
                        <option>North Carolina</option>
                        <option>North Dakota</option>
                        <option>Ohio</option>
                        <option>Oklahoma</option>
                        <option>Oregon</option>
                        <option>Pennsylvania</option>
                        <option>Rhode Island</option>
                        <option>South Carolina</option>
                        <option>South Dakota</option>
                        <option>Tennessee</option>
                        <option>Texas</option>
                        <option>Utah</option>
                        <option>Vermont</option>
                        <option>Washington</option>
                        <option>West Virginia</option>
                        <option>Wisconsin</option>
                        <option>Wyoming</option>
                        <option>American Samoa</option>
                        <option>Federated States of Micronesia</option>
                        <option>Guam</option>
                        <option>Marshall Islands</option>
                        <option>Northern Mariana Islands</option>
                        <option>Puerto Rico</option>
                        <option>Virgin Islands</option>
                        <option>Palau</option>
                        <option>AA</option>
                        <option>AE</option>
                        <option>AP</option>
                    </select>
                </div>
        </div>



Gender portion of form


    <!-- Multiple Radios (inline) -->
        <div class="form-group">
            <label class="col-md-5 control-label" for="gender">Gender</label>
                <div class="col-md-2"> 
                    <label class="radio-inline" for="gender-0">
                        <input type="radio" name="gender" id="gender-0"checked="checked" value="<?php echo $gender; ?>">
                            Male
                    </label> 
                    <label class="radio-inline" for="gender-1">
                        <input type="radio" name="gender" id="gender-1" value="<?php echo $gender; ?>">
                            Female
                    </label>
            </div>
        </div>

You need to use selected property of appropriate corresponding option.

Typically this is done programmatically by doing something like this:

//define array of all available states somehwere before you get to outputting the select
$state_options = array(
    'Alaska',
    'Alabama',
    ...
);

// then when outputting your state option elements, do it in a loop like this
<option value="">Select</option>
<?php
foreach($state_options as $state_option) {
    if ($state_option === $state) { 
        // this is selected state
        echo '<option value="' . $state_option . ' selected="selected">' . $state_option . '</option>';
    } else {
        // this is non selected option
        echo '<option value="' . $state_option . '>' . $state_option . '</option>';
    }
}
?>