Introduction :

We are browsing about 60 or 50 websites per a day when we are using internet , We can't see websites without a page Contact Us . Every official websites and blogs may contain a Contact Page to receive feedback from their visitors . Creating contact page is not a easier job . Webmasters and Wapmasters where searching on the Google Search Engine for readymade Contact Form script . Here on this topic you will learn about "How to Create a Custom Contact Form Using Php and Html" .

Follow the step carefully to create a Php contact form  :
First of all you need to create page with name "action.php" in your server and copy down the following script to the page .
";
        echo $error."

";
        echo "Please go back and fix these errors.

";
        die();
    }
    $first_name = $_POST['first_name']; // required
    $last_name = $_POST['last_name']; // required
    $email_from = $_POST['email']; // required
    $telephone = $_POST['telephone']; // not required
    $address = $_POST['address']; // required
 $product = $_POST['product']; // required
 $qty = $_POST['qty']; // required
 $remark = $_POST['remark']; // required
    $error_message = "";
    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(!preg_match($email_exp,$email_from)) {
    $error_message .= 'The Email Address you entered does not appear to be valid.
';
  }
    $string_exp = "/^[A-Za-z .'-]+$/";
  if(!preg_match($string_exp,$first_name)) {
    $error_message .= 'The First Name you entered does not appear to be valid.
';
  }
  if(!preg_match($string_exp,$last_name)) {
    $error_message .= 'The Last Name you entered does not appear to be valid.
';
  }
  if(strlen($address) < 2) {
    $error_message .= 'The Comments you entered do not appear to be valid.
';
  }
  if(strlen($error_message) > 0) {
    died($error_message);
  }
    $email_message = "Form details below.\n\n";
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
    $email_message .= "First Name: ".clean_string($first_name)."\n";
    $email_message .= "Last Name: ".clean_string($last_name)."\n";
    $email_message .= "Email: ".clean_string($email_from)."\n";
    $email_message .= "Telephone: ".clean_string($telephone)."\n";
    $email_message .= "Address: ".clean_string($address)."\n";
 $email_message .= "Product: ".clean_string($product)."\n";
 $email_message .= "Qty: ".clean_string($qty)."\n";
 $email_message .= "Remark: ".clean_string($remark)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);  
?>



 
 

Your Order Was Successfully Placed

We Will Contact You Soon To Your Phone Number For Conforming The Order Go To Home
Palce Another Order Now
After adding the code to your server change the following email address with your email address in the action.php page . Remember you must enter your email address that you want to recive the message .
    $email_to = "order@alaneesgroup.com";
    $email_subject = "New Order For Royal Digital TV ";
After make changes the email address , You need to create an other html page with name "form" or any other name you like and open the link address below "Html Contact Form" and copy paste the html code to that page you created in my example to the page "form" and save it as a html file.
Html Contact Form Code
Remember the form page must be placed on the folder that you created the "action.php" .
You are done ...
If you don't like the contact form html page design you can customize it by any design like you . Here i will show you some site which help you to make awesome html contact form design's .
  1. Php Form : Php Form is a free html Contact Form template maker , This site will help you to make awesome contact form for free .
Actually this script is for make order form .You can customize the code easy as you like by editing the "action.php" page .
If you need any help in editing the "action.php" contact me by using the comment box .

0 comments:

Post a Comment

Wapmaster or Webmaster can Comment Us with the following Comment Box . Don't add Links to your site for Spamming our Blog .. Once you add Comment with Link . It will be deleted immediatly by our Admins .

 
Top