needs_upgrade Posted August 8, 2008 Share Posted August 8, 2008 Hello guys! I'm not used to checkboxes and I have this code: $sql = "SELECT purchase_id, or_num, DATE_FORMAT(delivery_date, '%b %e, %Y'), line_total, balance FROM purchases WHERE supplier_id='$supplier_id' AND cancelled=0 AND balance > 0 ORDER BY purchase_id DESC"; $sres = mysql_query($sql); $snum = mysql_num_rows($sres); if ($snum > 0) { print "<center><table class=data width=400 border=1><thead class=data>"; print "<tr><td align=center colspan=5>Payable Purchases From Supplier</td></tr>"; print "<tr> <td align=center width=30></td> <td align=center width=70>O.R. #</td> <td align=center width=100>Delivery Date</td> <td align=center width=100>Line Total</td> <td align=center width=100>Balance</td> </tr></thead><tbody class=data>"; while ($srow = mysql_fetch_array($sres)) { print "<tr> <td align=center><input type=checkbox name=pid value=$srow[0]></td> <td align=center><a class=tddata href='purchase.php?purchase_id=$srow[0]'>$srow[1]</a></td> <td align=center>$srow[2]</td> <td align=right>"; $linet = number_format($srow[3], 2); print "$linet</td> <td align=right>"; $bal = number_format($srow[4], 2); print "$bal</td> </tr>"; } } print "<tr><td align=center colspan=5> <input type=hidden name=supplier_id value='$supplier_id'> <input type=submit value=Submit></td></tr>"; print "</tbody></table></form></center>"; My question is, how can i catch all the purchase_ids when i click the submit button? Thanks so much guys. Link to comment https://forums.phpfreaks.com/topic/118753-simple-question-about-checkboxes/ Share on other sites More sharing options...
MasterACE14 Posted August 8, 2008 Share Posted August 8, 2008 just like how you would grab any other form element. $_GET['pid'] or $_POST['pid'] Link to comment https://forums.phpfreaks.com/topic/118753-simple-question-about-checkboxes/#findComment-611420 Share on other sites More sharing options...
needs_upgrade Posted August 8, 2008 Author Share Posted August 8, 2008 what if the user checked many boxes, how will i be able to know which purchase_ids have been checked/selected? Link to comment https://forums.phpfreaks.com/topic/118753-simple-question-about-checkboxes/#findComment-611461 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.