Hi there I am new to the forum and if any of you could offer me some help with this it would be great.
I have created a form with a drop down menu, I have the form all setup but one of the requirements is to have the form retain the data upon submitting the form when an error occurs. all the fields are working except the drop down field.
THIS IS THE ENTIRE CODE
echo “”;
foreach($labels as $field => $label)
if($field == "state")
{
echo "<div class='field'><label for='$field'>$label</label>";
echo"<select name='states'>";
foreach($state as $value => $stateabr)
{
echo"<option value='$value'>";
if($_POST['states'] == $stateabr)
{
echo " selected='selected'";
}">";
echo"$stateabr";
echo"</option>";
}
echo"</select>";
echo"</div>";
}
else
{
echo "<div class='field'><label for='$field'>$label</label>
<input id='$field' name='$field' type='text' value='".@$$field."'
size='50%' maxlength='65' /></div>";
}
echo “”;
echo "
<input type='submit' name='pButton' value='$submit'></div>";
?>
any help would be great.