I am new to php and dropdown menus, my query works, but when displaying it is always missing the last row entered. So if I have two rows entered, the drop down will only display one? What am I doing wrong?
<?php
require("********");
$query=mysql_query("select * from types");
echo "<table >
<tr align='left'>
<th><font color='red'>Description</th>
</tr>";
$options='';
while($dbfield = mysql_fetch_array($query))
{
$options .= '<option>'.$dbfield['Description'].'</option>';
echo "
<form method='post'>
<td><select name='Description'><? echo $options; ?></select>
</tr>";
}
) your while
loop.mysql_
functions are also deprecated.
<?php
require("********");
$query=mysql_query("select * from types");
echo "<form method='post'>
<table>
<tr align='left'>
<th><font color='red'>Description</th>
</tr>";
$options='';
while($dbfield = mysql_fetch_array($query)) {
$options .= '<option>'.$dbfield['Description'].'</option>';
}
echo "<tr>
<td><select name='Description'><? echo $options; ?></select>
</tr>";