I have an update page where users can update their registration information. I will be using a drop-down menu list for states that pulls the state values from a database. For some reason, the menu shows the wrong state when the page is loaded (the first one in the database), and when you click the down arrow to see more states only the first state in the database is shown in the list. My code is below. Thank you for your help in advance.
<select name="state" id="state" title="<?php echo $data['person_state']; ?>">
<?php
do {
?>
<option value="<?php echo $data_state['state_abbreviation']?>"<?php if (!(strcmp($data_state['state_abbreviation'], $data['person_state']))) {echo "selected=\"selected\"";} ?>><?php echo $data_state['state_abbreviation']?></option>
<?php
} while ($data_state = mysql_fetch_assoc($state));
$rows = mysql_num_rows($state);
if($rows > 0) {
mysql_data_seek($state, 0);
$data_state = mysql_fetch_assoc($state);
}
?>
</select>
Let me know if you need any more information. I had to leave out the rest of the code because the post was too long. Thanks again!