I have a checkbox naming problem!
What I am trying to do is to insert in to mysql a $varible only where a checkbox is is check in the form.
I have a while statement that show all the items in a members cart and i'm to make it where if they want an item shipped they select a checkbox for that Item and it will update a field the mysql table.
my issue is that the number checkboxes varies with the number of items and the chosing the name of the field for mysql to identify which item to update.
Here is what I have:
$i=1;
$resulta = mysql_query("SELECT * FROM testtitles WHERE orderid='$itmx' ",$db);
while($myrowx= @mysql_fetch_array($resulta)){
$item = $myrowx["item"];
$io+=$i;
echo "<br/><table width=600 border=0><tr><td align=left>
<b>Item No: $xxitemnumberx</b>
<br/>
$xxtitlex
</td></tr><tr><td>
<table border=0 width=\"600\">
<tr>
<td width=75 class=style5><u>Item</u></td>
<td align=center class=style5>Pack It!</td>
</tr>
<tr>
<td width=75 class=style3>$item</td>
<td align=center><input type=\"checkbox\" name=\"sel$io\" value=\"Packed\"><input type=hidden name=selitmx value=$xxitemnumberx>
</td></tr></table>";
if (submit){
$queryp = "update testtitles SET ship_status='Shipped', ship_date='$datex' WHERE itemnumber = '$selitmx' AND sel$io = 'Packed' ";
$resultp = mysql_query($queryp);
}}
I'm sure this has been done before but I can't seem to any examples quite like it. Any Ideas?