I am trying to get php to display the items in my table in a drop down menu by doing a foreach loop. It almost working but it displays the items in separate dropdown menus when I want them to be all be displayed in the same menu.
<?php
$product_array = $db_handle->runQuery("SELECT * FROM tblproduct ORDER BY id ASC");
if (!empty($product_array)) {
foreach($product_array as $key=>$value){
?>
<form method="post" action="index.php?action=add&code=<?php echo $product_array[$key]["code"]; ?>">
<select id="Select_Product" name="Select_Product" class="select">
<?
echo '<option value=$product_array[$key]["code"]>'.$product_array[$key]["name"].'</option>';
}
}
?>
</select>
<div>Amount:<input type="text" name="quantity" value="1" size="2" /><input type="submit" value="Add to cart" class="btnAddAction" /></div>
</form>