I have done google searches and found several answers but I cannot get this to work. I am trying to read a field from ym mysql database and create and populate a combo box containing those values. The database connection works but all I get is a list of the values and no combo box. I am posting my code, along with the results.
<?php
$cn=mysql_connect("localhost","username","password") or die(mysql_error());
mysql_select_db("db_name",$cn) or die(mysql_error());
$sql = "SELECT LoadNumber FROM tblLoads";
$result = mysql_query($sql);
?>
<select name="loads" size=1>
<?
while($ri = mysql_fetch_array($result))
{
echo "<option value=" .$ri['LoadNumber'] . ">" . $ri['LoadNumber'] . "</option>";
}
echo "</select> "
?>
Here is my output:
1637825
1637933
1638102
1638109
1638574
1638683
>
Please, this is driving me crazy, i don't see what I am doing wrong. it does not create the combo box.
$ri['LoadNumber']'s value in quotes, for example.echo "</select> "and make sure short tags are enabled. Error reporting would have signaled that "syntax" error which is off-topic.