Page 1 of 1

simple if error

Posted: Fri Aug 22, 2008 7:26 pm
by pinehead18
So i have an email form. this is my code on the page

Code: Select all

 
if ($_GET['submit']) {
 
$sendm = new sendmail();
$first_last = "anthony_james";
$sendm->query($first_last);
echo $sendm->email;
echo $sendm->query;
 
}
 
But if $submit is not set i get Notice: Undefined index: submit

Other than error_reporting(5) what cna i do to prevent this. Why can we not have empty variables?

Re: simple if error

Posted: Fri Aug 22, 2008 7:34 pm
by it2051229

Code: Select all

 
if(isset($_GET["submit"]))
{
   // then start processing
}
 

Code: Select all

 
if(isset($_POST["submit"]))
{
   // then start processing
}