how to update select multiple menu??
how can i update the select multiple menu??
i have this in a form:
<?php
$all_pro = mysql_query(\"select pro_name from sc_product where pro_name != '$pro_name'\");
while ($temp = mysql_fetch_array($all_pro))
{
$pro_name = $temp['pro_name'];
echo \"<option value=\\"$pro_name\\" \";
$sel_sim = mysql_query(\"select * from sc_similar where sku='$sku'\");
while ($rp = mysql_fetch_array($sel_sim))
{
//$sim_id = $rp['sim_id'];
$sku_sim = $rp['sku'];
$name = $rp['pro_sim'];
if ($pro_name == $name)
echo \"selected\";
}
echo \">$pro_name</option>\";
}
echo \"</select></td></tr>\";
?>
this will retrieve and select the select multiple menu. the problem is i can't seems to update it. for eg if i unselect the exisitng one and select a new record..how can i update my database??
it seems tat i can only pass one value, instead of 2..
<?php
$pro_sim = $HTTP_POST_VARS['pro_sim'];
$sim_name = $HTTP_POST_VARS['sim_name'];
for ($i=0; $i<count($sim_name); $i++)
{
$upd = mysql_query(\"update sc_similar set sku = '$sku', pro_sim = '$pro_sim[$i]' where pro_sim = '$sim_name[$i]'\");
}
?>
no matter how many records i select, i can only get one sim_name's value. pls advice.
ROB posted this at 17:32 — 28th August 2002.
They have: 447 posts
Joined: Oct 1999
did you name the select box as an array, ie:
<SELECT NAME="sim_name[]" MULTIPLE>
'Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.