My php code to populate drop downs look like this:
<head>
<title>STOCKINSERT</title>
<?php session_start();
$conn = new mysqli('localhost', 'root', 's', 'smv') or die ('Cannot connect to db');
$result = $conn->query("select code, name from itemname");
$hvo = $conn->query("select code, name from hvomaster where TYPE=1");
$spoke = $conn->query("select code, name from hvomaster where TYPE=3");
?>
</head>
The HTML to show drop down does not show any thing
<span style="font-weight: bold;">
High volume Outlet
</span>
</td>
<td>
<p><font size="+1"><select name="id">
<?
php session_start();
while ($row = $hvo->fetch_assoc())
{
unset($id, $name);
$id = $row['code'];
$name = $row['name'];
echo '<option value="'.$id.'">'.$name.'</option>';
}
?>
</select>
</font>
</p>
</td>
But the HTMl to show this drop down works :
<td style="vertical-align: top; width: 392px; text-align: center; height: 80px; font-family: Arial Narrow;"><p><font size="+1">
<select name="id">
<?php session_start();
while ($row = $result->fetch_assoc())
{
unset($id, $name);
$id = $row['code'];
$name = $row['name'];
echo '<option value="'.$id.'">'.$name.'</option>';
}
?></select></font></p></td>
What is wrong ? Please help