The code below will create a dropdown box with all the stores listed, how can I have the dropdown set to a store value that is set in the DB?
For instance, a user submits and item to my DB that is from Kroger. When the user wants to edit that Item I need the dropdown box to be set to Kroger but have the other store values in the list.
<?php
$sql="SELECT * FROM store";
$result=mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result)) {
$storename = $row["store_name"];
//$cat_id=$row["cat_id"];
$options.="<OPTION VALUE=\"$storename\">" .$storename."</option>";
}
while (isset($_POST['store_name']) && is_array($_POST['store_name'])) {
$items = implode(", ", $_POST['store_name']);
}
?>
<SELECT NAME=store[]>Category<?php echo $options?></SELECT>