tomtimms Posted May 6, 2010 Share Posted May 6, 2010 I have a checkbox form that when you check the box and update the discount field it will update that record. Is there a way to have multiple for each loops to do this? Below is my form. while ($rows = mysql_fetch_assoc($result)) { echo "<form id='accounting_approval' name='accounting_approval' method='post' action='payment_processing.php'>"; echo "<table>"; echo "<tr>"; echo "<td>"; echo $rows['name']; echo "</td>"; echo "<td>"; echo "<input type=checkbox name=cbox[] value=".$rows['company'].">"; echo "</td>"; echo "<td>"; echo "<input type='text' name='adjustment' id='adjustment' value='0' size='2' />"; echo "</td>"; echo "</tr>"; } echo "</table>"; echo "<input type='submit' name='submit' value='submit' />"; echo "</form>"; here is my process, I can't seem to have the values updated with the boxes that are checked. $id= $_POST['cbox']; $adjustment = $_POST['adjustment']; $array_cbox = explode(",",$cbox); $array_adjustment = explode(",",$adjustment); for ($i=0; $i < count($id); $i++) { //my query to update } Link to comment https://forums.phpfreaks.com/topic/200936-php-multiple-checkbox-form/ Share on other sites More sharing options...
iblood Posted May 6, 2010 Share Posted May 6, 2010 echo "<form id='accounting_approval' name='accounting_approval' method='post' action='payment_processing.php'>"; echo "<table>"; while ($rows = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>"; echo $rows['name']; echo "</td>"; echo "<td>"; echo "<input type=checkbox name=cbox[] value=".$rows['company'].">"; echo "</td>"; echo "<td>"; echo "<input type='text' name='adjustment' id='adjustment' value='0' size='2' />"; echo "</td>"; echo "</tr>"; } echo "</table>"; echo "<input type='submit' name='submit' value='submit' />"; try this.. , open wide... , jokes.. Link to comment https://forums.phpfreaks.com/topic/200936-php-multiple-checkbox-form/#findComment-1054359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.