Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="enquiryform" name="enquiryform" action="contact.php" method="post" >
- <table border="0" cellspacing="2" cellpadding="4" align="left">
- <tr>
- <td>Name</td>
- <td><input name="efcontactname" type="text" class="fields" value="" /></td>
- </tr>
- <tr>
- <td>Company Name</td>
- <td><input name="efcompanyname" type="text" class="fields" value="" /></td>
- </tr>
- <tr>
- <td>Postcode</td>
- <td><input name="efpostcode" type="text" class="fields" value="" /></td>
- </tr>
- <tr>
- <td>Telephone Number</td>
- <td><input name="eftel" type="text" class="fields" value="" /></td>
- </tr>
- <tr>
- <td>Email Address</td>
- <td><input name="efemailaddress" class="fields" type="text" value="" /></td>
- </tr>
- <tr>
- <td>Re:</td>
- <td>
- <select name="efenquirytype">
- <option value="">Please indicate the nature of your enquiry</option>
- <option value=""></option>
- <option value="Sales">Sales</option>
- <option value="Hire">Hire</option>
- <option value="Parts">Parts</option>
- <option value="Service">Service</option>
- <option value="General">General</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>Comments</td>
- <td><textarea name="efcomments" class="fields"class="fields" cols="30" rows="4"></textarea></td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <input type="submit" value="Send Enquiry" />
- </td>
- </tr>
- </table>
- </form>
- <?php
- $EmailFrom = "$email";
- $EmailTo = "myemail@mydomain.com";
- $Subject = "Website Enquiry";
- $name = Trim(stripslashes($_POST['efcontactname']));
- $company = Trim(stripslashes($_POST['efcompanyname']));
- $postcode = Trim(stripslashes($_POST['efpostcode']));
- $phone = Trim(stripslashes($_POST['eftel']));
- $email = Trim(stripslashes($_POST['efemailaddress']));
- $re = Trim(stripslashes($_POST['efenquirytype']));
- $comments = Trim(stripslashes($_POST['efcomments']));
- // validation
- $validationOK=true;
- if (!$validationOK) {
- print "<meta http-equiv="refresh" content="0;URL=error.html">";
- exit;
- }
- // prepare email body text
- $Body = "";
- $Body .= "Name: ";
- $Body .= $Name;
- $Body .= "n";
- $Body .= "Company: ";
- $Body .= $company;
- $Body .= "n";
- $Body .= "Postcode: ";
- $Body .= $postcode;
- $Body .= "n";
- $Body .= "Phone: ";
- $Body .= $phone;
- $Body .= "n";
- $Body .= "email: ";
- $Body .= $email;
- $Body .= "n";
- $Body .= "Re: ";
- $Body .= $re;
- $Body .= "n";
- $Body .= "Comments: ";
- $Body .= $comments;
- $Body .= "n";
- // send email
- $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
- // redirect to success page
- if ($success){
- print "<meta http-equiv="refresh" content="0;URL=index.html">";
- }
- else{
- print "<meta http-equiv="refresh" content="0;URL=error.html">";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement