simple if error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

simple if error

Post 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?
User avatar
it2051229
Forum Contributor
Posts: 312
Joined: Tue Dec 25, 2007 8:34 pm

Re: simple if error

Post by it2051229 »

Code: Select all

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

Code: Select all

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