I'm using a while loop to fill a drop down menu with options from a SQL table but my old friend PHP responds with a lovely blank page.
What am I doing wrong? Probably something completely obvious..
<?php
include("DbConnect.php");
$Query = "SELECT VehNo, Make_Model FROM vehicle
order by VehNo";
$Result = mysql_select_query($DB,$Query);
echo'<label>';
echo'<select name = "Vehicle">';
while ($Row = mysqli_fetch_assoc($Result))
{
echo'<option value ='".$Row["VehNo"]."'>'".$Row["Make_Model"]."'</option>';
}
echo'</label>';
?>
Thanks in advance.
Edit:
<form method="POST" action="detailsShow.php">
<?php
include("DbConnect.php");
$Query = "SELECT VehNo, Make_Model FROM vehicle
order by VehNo";
$Result = mysql_query($DB,$Query);
echo'<label>';
echo'<select name = "Vehicle">';
while ($Row = mysql_fetch_assoc($Result))
{
echo'<option value ='".$Row["VehNo"]."'>".$Row["Make_Model"]."</option>';
}
echo'</label>';
?>
<INPUT TYPE="submit" VALUE="see a nice piccy of the car">
</FORM>
Change:
echo'<option value ='".$Row["VehNo"]."'>'".$Row["Make_Model"]."'</option>';
to:
echo "<option value =\"{$Row['VehNo']}\">{$Row['Make_Model']}</option>";
and it should work.
Also enable errors for the next time.