View Single Post
05-25-2008, 04:57 PM
#5
Andrew R is offline Andrew R
Status: Request a custom title
Join date: Dec 2005
Location: Arizona
Expertise:
Software:
 
Posts: 5,200
iTrader: 17 / 95%
 

Andrew R is on a distinguished road

  Old

Originally Posted by enigma View Post
Simple way is like this;

PHP Code:
<?php

if($email == "") {

echo 
"You must enter your email!";

} else {

mail();

}

?>
But you add as many error check as you like. Expanding on the above..

PHP Code:
<?php

if($name == "") {

echo 
"Give me your name dammit!";

}

if(
$subject == "") {

echo 
"Enter a subject!";

}

if(
$email == "") {

echo 
"You must enter your email!";

} else {

if(
$comments == ""){

echo 
"Comments - Empty!";

} else {

mail();

}

?>
Well, not only have you not finished an if statement in there, that's a horrid way of doing it. Just use elseifs, otherwise they could send an email without entering a name or a subject.