Advertisement
immbudden

contact.php

May 16th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. <?php
  2.  
  3. include 'config.php';
  4.     error_reporting (E_ALL ^ E_NOTICE);
  5.     $post = (!empty($_POST)) ? true : false;
  6.  
  7. if($post)
  8.     {
  9.         include 'functions.php';
  10.         $firstName = stripslashes($_POST['firstName']);
  11.         $lastName = stripslashes($_POST['lastName']);
  12.         $email = trim($_POST['email']);
  13.         $country = stripslashes($_POST['country']);
  14.        
  15.         $message = "";
  16.         $message .= "First Name: ";
  17.         $message .= $firstName;
  18.         $message .= "\n";
  19.         $message .= "Last Name: ";
  20.         $message .= $lastName;
  21.         $message .= "\n";
  22.         $message .= "Email: ";
  23.         $message .= $email;
  24.         $message .= "\n";
  25.         $message .= "Country ";
  26.         $message .= $country;
  27.        
  28.  
  29.         $error = '';
  30.  
  31. // Check firstName
  32. if(!$firstName)
  33.     {
  34.         $error .= 'You forgot to enter your first name.<br />';
  35.     }
  36.    
  37. // Check lastName
  38. if(!$lastName)
  39.     {
  40.         $error .= 'You forgot to enter your last name.<br />';
  41.     }
  42.    
  43. // Check country
  44. if(!$country)
  45.     {
  46.         $error .= 'You forgot to enter your country.<br />';
  47.     }
  48.    
  49. // Check email
  50. if(!$email)
  51.     {
  52.         $error .= 'You forgot to enter your e-mail id.<br />';
  53.     }
  54. if($email && !ValidateEmail($email))
  55.     {
  56.         $error .= 'Invalid E-mail id !!!<br />';
  57.     }
  58. if(!$error)
  59.     {
  60.         $subject = 'Hi, '.$firstName. '  ' .$lastName. '  is interested in Ireland - In a new light';
  61.         $mail = mail(WEBMASTER_EMAIL, $subject, $message,
  62.             "From: ".$firstName." ".$lastName." <".$email.">\r\n"
  63.             ."Reply-To: ".$email."\r\n"
  64.             ."X-Mailer: PHP/" . phpversion());
  65. if($mail)
  66.     {
  67.         echo 'OK';
  68.     }
  69. }
  70. else
  71.     {
  72.         echo '<div class="notification_error">'.$error.'</div>';
  73.     }
  74. }
  75. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement