stock.php
<td>Produk :</td><br>
<td>
<select name="batch" onchange="submit();">
<option value="-1" >-- Select Address --</option>
<?php
$username='root';
$password='';
$con = mysql_connect('localhost', $username, $password);
mysql_select_db('snack', $con);
$result = mysql_query("SELECT * FROM po");
while($row = mysql_fetch_array($result))
{
}
$data = array(
'1'=>array('po'=>'1','namn'=>'name 1'),
'2'=>array('po'=>'2','namn'=>'name 2'),
'3'=>array('po'=>'3','namn'=>'name 3'),
'4'=>array('po'=>'4','namn'=>'name 4'),
'5'=>array('po'=>'5','namn'=>'name 5')
);
foreach($data as $item){
echo "<option value='{$item['po']}'>{$item['namn']}</option>\r\n";
}
?>
</select>
</td>
What should I replace this with?
while($row = mysql_fetch_array($result))
{
}
I basically need to see the combo box filled with items from sql_query.
If anyone can help me fix the code, would be great.