ToBe

ToBe

  • NA
  • 164
  • 92.2k

PHP Code

Jul 23 2013 7:16 AM
Hi everyone 

I have this code and i want to validate the email :

it will always gives Internal Server error 

help me please in this code :

   <?php 
      
              /* send the submitted data */ 
    
    $name=$_REQUEST['name']; 
    $email=$_REQUEST['email']; 
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
    $message=$_REQUEST['message']; 

    if (($name=="")||($email=="")||($message=="")) 
        { 
        echo "All fields are required, please fill <a href=\"\">the form</a> again."; 
        } 

    elseif
     (!preg_match($email_$_REQUEST['email'])) 
     {
     $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
     }

    else {
        $from="From: $name<$email>\r\nReturn-path: $email"; 
        $subject="Message sent using your contact form"; 
        mail("[email protected]", $subject, $message, $from); 
        echo "Email sent!"; 
         } 
       
?>

Answers (1)