Form not creating array properly
Posted: Fri Apr 04, 2008 5:11 pm
This is a strange problem and I'm not sure where to look for the answer.
<form method="post" action="process.php">
<input type="checkbox" name="recid" value="44"/>
<input type="checkbox" name="recid" value="35"/>
<input type="checkbox" name="recid" value="25"/>
<input type="checkbox" name="recid" value="80"/>
</form>
I want to take this data and loop it.
My process page code is:
$data = array($_REQUEST['recid']);
foreach ($data as $val )
{
echo '<br> Data: '.$val.'<br>';
}
But my array only displays the last value (in this case 80). I can't get more than one value to display.
When I change method to GET I get:
?recid=44&recid=35&recid=25 on the URL. But still only get the last value to display.
Any ideas?
Thanks.
<form method="post" action="process.php">
<input type="checkbox" name="recid" value="44"/>
<input type="checkbox" name="recid" value="35"/>
<input type="checkbox" name="recid" value="25"/>
<input type="checkbox" name="recid" value="80"/>
</form>
I want to take this data and loop it.
My process page code is:
$data = array($_REQUEST['recid']);
foreach ($data as $val )
{
echo '<br> Data: '.$val.'<br>';
}
But my array only displays the last value (in this case 80). I can't get more than one value to display.
When I change method to GET I get:
?recid=44&recid=35&recid=25 on the URL. But still only get the last value to display.
Any ideas?
Thanks.