<input type="checkbox" name="graphic[]" php loop through

  • helloise
  • Born
  • Born
  • helloise
  • Posts: 3

Post 3+ Months Ago

i have the following: a list of products each with a graphic and text checkbox

in productSuccess.php:
foreach($product_names as $product_row) { ?>
<tr>
<td >&nbsp;</td><td width='200px'><?php echo $product_row->getName(); ?></td>
<td width='200px'><input type="checkbox" name="graphic[]" value="<?php echo $product_row-getBy?>" />
</td><td width='200px'><input type="checkbox" name="text[]" value="<?php echo $product_row?>" /></td>
</tr>
?php } ?>
with a form tag:
<form action="<?php echo url_for('doc/document'); ?>" method="post">


and the other part in documentSuccess.php
how can i check which checkboxes where checked for which product??????
foreach($_POST['graphic'] as $graphic)
{
if($graphic == 'some_value')
{
// "some_value" comes from whatever is in the "value" attribute of the <input> element
}
}

how will i do the foreach loop now please??? shall i have a <input type=hidden tag......with the form tag???? please help
thanks
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 88 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.