problem with check boxes
Posted: Mon Aug 11, 2008 12:47 am
I am trying to test a html check box selected option..
I have a html page with about 6 checkboxes and the action page will have to access all the parameters which are checked and i need to display them..
Here is the initial page code :
***** PLEASE USE THE
Now the action script for the code ie.,checkbox2.php
Now i dont get any out put.. it only shows a blank page.
if i type:
echo $option1 and if option1 of the main page is selected, it shows the output..
But if i try to put it in a loop, i am not getting any output.
Can someone help me in this regard..
I have a html page with about 6 checkboxes and the action page will have to access all the parameters which are checked and i need to display them..
Here is the initial page code :
***** PLEASE USE THE
Code: Select all
ORCode: Select all
TAGS *****[/color]Code: Select all
//total in html
<html>
<head>
</head>
<title> learn checkbox </title>
<body>
<form action= "checkbox2.php" method="post">
<input type="checkbox" name="option1" value ="Check1" >Check1 <br />
<input type="checkbox" name="option2" value ="Check2" >Check2 <br />
<input type="checkbox" name="option3" value ="Check3" >Check3 <br />
<input type="checkbox" name="option4" value ="Check4" >Check4 <br />
<input type="checkbox" name="option5" value ="Check5" >Check5 <br />
<input type="checkbox" name="option6" value ="Check6" >Check6 <br />
<input type = "submit" value= "submit" />
</form>
</body>
</html>
//first page code ended hereNow the action script for the code ie.,checkbox2.php
Code: Select all
//checkbox2.php starts here
<?php
for($i=1;$i<7;$i++)
{
$option[$i]= $_POST['option$i'];
}
for($i=1;$i<7;$i++)
{
echo $option[$i];
}
?>
//checkbox2.php ends here...if i type:
echo $option1 and if option1 of the main page is selected, it shows the output..
But if i try to put it in a loop, i am not getting any output.
Can someone help me in this regard..