Hey smart ones,
I have a form.
when a user clicks the submit button and forgot to fill-out one text field an error message comes up.
I'm trying to get the below drop-down menu to stay selected with what the user selected before they clicked the submit (so they don't have to keep selecting every time they make a mistake)
<? $strGetProv = "SELECT * FROM mobile_provider ORDER BY provider";
$rstGetProviders = sqlQuery($strGetProv, $mySql);
foreach ($rstGetProviders as $provider){
if ($_POST['provider']){
echo "<option value=\"{$provider['id']}\" selected>{$provider['name']}</option>";
}else{
echo "<option value=\"{$provider['id']}\">{$provider['name']}</option>";
}
}
?>
The above code doesn't do it. why?
Thanks