processing arrays from forms
| From: | Scott | Date: | Sun, 25 Jan 2004 19:53:47 +0000 |
| Subject: | processing arrays from forms | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-175686@lists.php.net to get a copy of this message | ||
Hello,
In page_1.php I have this form:
<?
$num_rows = count ($s_goal);
for ($i = 0; $i < $num_rows; $i++) {
echo "
<table width='98%'>
<tr>
<td>
<form action=page_2.php method=POST>
<input type=checkbox name=meth[] value=TMT>
<input type=checkbox name=meth[] value=TO>
<input type=checkbox name=meth[] value=SA>
<input type=checkbox name=meth[] value=ST>
</td>
</table>";
}
?>
<input type='submit' name='submit' value='Enter'>
</form>
On page_2.php I have this:
<?
$meth=$_POST['meth'];
foreach($meth as $m) {
echo "<tr><td>$m</td></tr>";
}
?>
Which gives me a list of values from each box that was checked -- but I
haven't been able to figure out how to process it so that each iteration
of the form on page_1.php prints in a new table row on page_2.php. Any
help appreciated.
Thanks,
SW