Jump to content

PHP Multiple Checkbox Form


tomtimms

Recommended Posts

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


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... :P, jokes.. ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.