I am just experimenting with some php at the top of my page to process some form data. It seems to want me to declare the variable even though this does not exist as it will be passed when the form is submitted.
I am getting the following error Notice: Undefined index: mysubmit in /home/grsim/public_html/age1.php on line 3
<?php
$problem='';
if($_POST['mysubmit']=="Submit Form"){
if($_POST['age']==''){
$problem="The form is blank";
} else {
// do something
$myage = $_POST['age'];
if($myage < 21){
echo "you are a bit young for this";
} else {
echo "you are old enough";
}
}}
Any help would be appreciated as I have not had to declare variables before use. I am using a button with the name of mysubmit.