I have a simple form that edits student information. I have several fields that I have a drop down list pulled as an array from a separate table. I would like the information that is already entered on the student to be the default but still have the drop down list available if the item was entered in error. For example: Drop down list of all the states of America, OH was entered for the student, when the edit form comes up for State in Address I would like OH to be the default but still have the list to choose if OH was entered in error. I have tried selected = $selected but then the entire drop down changed to OH. I am very, very much a beginner in this
<?php
// list of possible modules comes from database
$state_array=get_states();
//display as a drop down list for end user to choose
if (!is_array($state_array))
{
echo "<p>No States are currently available<p>";
return;
}
foreach ($state_array as $row)
{
echo "<option value=\"".($row['stateid'])."\"";
// if existing state, put in current catgory
echo "<strong> ".($row['stateid'])."</strong><br />";
echo "<option select=\"selected\">OH";
}
?>