<?php
define("ContactEmail", "highwebgeeta@gmail.com");
$error_msg = 'The following fields were left empty or contain invalid information:<ul>';
$error = false;
$submit = $_POST['submit'];
if (empty($submit))
$form_submitted = false;
else
$form_submitted = true;
if ($form_submitted) {
$title = $_POST['title'];
$name = $_POST['name'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$pin = $_POST['pin'];
$country = $_POST['country'];
$contact = $_POST['contact'];
$email = $_POST['email'];
if(!$name) { $error_msg .= "<li>Full Name</li>"; $error = true; }
if(!$email) { $error_msg .= "<li>E-mail Address</li>"; $error = true; }
if(!$contact) { $error_msg .= "<li>contact</li>"; $error = true; }
if($email) { if(!eregi("^[a-z0-9_]+@[a-z0-9\-]+\.[a-z0-9\-\.]+$", $email)){ $error_msg .= "<li>E-mail Address</li>"; $error = true; }}
$error_msg .= "</ul>";
if (!$error) {
$msg = "Full Name: \t $name \n";
$msg .= "Contact: \t $contact \n";
$msg .= "E-mail Address: \t $email \n";
$msg .= "address: \n---\n $address \n---\n";
$mailheaders = "Enquiry";
$mailheaders .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$mailheaders .= "From: $name <$email>\r\n";
$mailheaders .= "Reply-To: $name <$email>\r\n";
mail(ContactEmail, $subject , stripslashes($msg), $mailheaders);
}
}
?>
<?php
// email was successfully send
if (($form_submitted) && (!$error)) {
?>
<!-- display submitted data -->
Thank you for your feedback, <?php echo $name; ?>.
This is the information you submitted:<br><br><?php echo nl2br(stripslashes($msg)); ?>
i create a contact form that link to 5 pages , please help me to create a contact form using php..