Created
July 18, 2012 13:49
-
-
Save colmtuite/3136325 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//If form was submitted | |
if(isset($_POST['submitted'])) { | |
$errormsg = ""; //Initialize errors | |
if(isset($_POST['emailaddress']) && $_POST['emailaddress'] != "Email Address"){ | |
$emailaddress = $_POST['emailaddress']; // If title was entered | |
} | |
else{ | |
$errormsg = "* Please enter an email address"; | |
} | |
if(isset($_POST['message']) && $_POST['message'] != "Type your message here"){ | |
$message = $_POST['message']; // If comment was entered | |
} | |
else{ | |
$errormsg = "* Please enter a message"; | |
} | |
if(empty($errormsg)){ | |
$to = "[email protected]"; | |
$subject = "Web Contact Form"; | |
$extra = "From: $emailaddress"; | |
$phone = "Phone: $phone"; | |
if(mail($to, $subject, $message, $phone, $extra)){ | |
header("Location: http://www.carpetcleaninggenie.ie/success.php"); | |
} | |
} | |
} | |
?> | |
<form action="contact.php" method="post" id="contact-form"> | |
<fieldset> | |
<textarea name="message" id="contact_message" cols="65" rows="9"><?php if(isset($message)){ echo $message; } else { echo "Type your message here"; }?></textarea> | |
<input name="emailaddress" id="contact_email" value="Email Address" type="text" /> | |
<input name="phone" id="contact_phone" value="Phone Number" type="text" /> | |
</fieldset> | |
<input type="submit" id="submit" name="submitted" value="Send Message" /> | |
</form> | |
<?php | |
if(!empty($errormsg)): ?> | |
<div class="error"> | |
<?php echo $errormsg; ?> | |
</div> | |
<?php endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment