View Single Post
Old 12-16-2008, 02:55 PM   #1 (permalink)
code_junkie
The Contributor
 
Join Date: Sep 2008
Posts: 39
Thanks: 9
code_junkie is on a distinguished road
Default Required fields in a contact form

I am making a contact form that needs required fields. I have it set for one field to be required, but when I try to make the other fields required I get a white page. Here is my code:
Code:
if (isset($_POST['submit'])) {
  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];
  $to = "something@somewhere.com";
  if(!$name && !$email && !$message) {
    $error = '<p style="color:#FF0000">Please complete all required fields</p>';
  } else {
	$subject = "TxDOT Watch Report";
	$from = "From: $email \r \n";
	
    ini_set('sendmail_from', $email);
	mail($to, $subject, $from, $message);
  }
}
Any help will be appreciated. Thanks
__________________
Trying to learn all I can about PHP. Teach me what you know...
code_junkie is offline  
Reply With Quote