hi, I want to display the checkbox question on the web page. and i need catch the user's response after user press the submit button.
But i got the following problem:
Parse error: parse error, expecting `']'' in new1.php on line 7.
I had two php pages,
new.php
<?
print "<table>";
print "<form method='post' action='new1.php'>";
for($i=1;$i<=4;$i++)
{
print "<tr><td><input type ='checkbox' name='answer[1$i]'>test</td></tr>";
}
print "<tr><td><input type='submit' name='submit' value='submit'></td></tr>";
print "</form>";
print "</table>";
?>
new1.php
<?
if($submit == "submit")
{
print "<table>";
for($i=1;$i<=4;$i++)
{
if($answer[1$i] == "on") (!!!!this line is 7 line!!!!)
{
print "<tr><td><input type ='checkbox' name='answer[1$i]' checked>test</td></tr>";
}
else
{
print "<tr><td><input type ='checkbox' name='answer[1$i]'>test</td></tr>";
}
}
}
?>
anybody can help?
Angela