I'm trying to create an update form for a automobile database in PHP.
I get the "mid" of the current value of the car model like this:
$current_mid= $row['mid'];
Then I display it in a drop down box populated with all the models and set the "selected" value based on what the current model is:
while($row = mysqli_fetch_array($carResult))
{
echo '<option value="'.$row['mid'].'"'.(($row['mid'] == $current_mid )? 'selected="selected"' : '').'>' .$row['modelName'].'</option>';
}
When I run this, I do see all the models, but the 'selected' value is never set.
Also, when I examine the html code in the browser, I see errors like this between each value:
Notice: Undefined index: mid in C:\xampp\htdocs\CarMakes\updateCar.php on line 90
line 90 is the echo line above.
I'm not sure why it's not working and why the browser is getting those errors.
Any help would be greatly appreciated!