I'm running into some problems when I'm trying to do a simple checkbox deal on php. I was wondering if you guys knew anything I didn't. Take a look at this.
test1.php:
<html>
<body>
<form name=myForm action="test2.php" method="post">
Enter random text
<br>
<li><input type="text" name="test"></li>
<br>
Check me or not:
<INPUT type="checkbox" name="testcheck" value="1"><BR>
<input type="submit" value="Submit">
</form>
</body>
</html>
test2.php:
<html>
<body>
<?
$check = $_POST['testcheck'];
if($check) {
print ('box is checked');
} else{
print ('box is NOT checked');
}
?>
</body>
</html>
But for reason when my box is unchecked my broswer is displaying:
'Notice: Undefined index: testcheck in C:\Program Files\Apache Group\Apache2\htdocs\test2.php on line 5
box is NOT checked'
I don't know how to get rid of this freaking 'Notice'.
When the box is checked then it says:
'box is checked'
which is ok. Anyone have any ideas?
test1.php:
<html>
<body>
<form name=myForm action="test2.php" method="post">
Enter random text
<br>
<li><input type="text" name="test"></li>
<br>
Check me or not:
<INPUT type="checkbox" name="testcheck" value="1"><BR>
<input type="submit" value="Submit">
</form>
</body>
</html>
test2.php:
<html>
<body>
<?
$check = $_POST['testcheck'];
if($check) {
print ('box is checked');
} else{
print ('box is NOT checked');
}
?>
</body>
</html>
But for reason when my box is unchecked my broswer is displaying:
'Notice: Undefined index: testcheck in C:\Program Files\Apache Group\Apache2\htdocs\test2.php on line 5
box is NOT checked'
I don't know how to get rid of this freaking 'Notice'.
When the box is checked then it says:
'box is checked'
which is ok. Anyone have any ideas?