Making a Success/Error message appear after sent mail
So I have spent the past week (about 10 hours in total) looking for a way to make a jQuery message appear without a reload after someone send me a message using my contact me form.
Yet all the tutorials I have read (20-30) have included a success/error message but also have many other messages. Since im a beginer to jQuery I have no idea which is which and how to cut out what I wan't.
So I was wondering if somone hear could tell me how I could accomplish this using jquery-1.2.6.min.js
Here is the code I'm using...
PHP:
-
<?php
$emailsubject = 'Contact';
$webMaster = 'my@email.com';
$nameField = $_POST ['name'];
$emailField = $_POST ['email'];
$messageField = $_POST ['message'];
$body = <<<EOD
<br><hr><br>
Name: $nameField <br>
Email: $emailField <br><hr><br>
Message: $messageField <br>
<br><hr><br>
EOD;
$headers = "From: $emailField\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailsubject, $body, $headers);
if (mail($webMaster, $emailsubject, $body, $headers) ) {
echo "email sent!";
} else {
echo "Please try agian.";
}
?>
And my HTML:
-
<form name="form1" method="post" action="">
<span id="textfield1">
<label for="name">FIrst Name: </label>
<input type="text" name="name" id="name">
</span>
<br><br>
<span id="textfield2">
<label for="email">Email: </label>
<input type="text" name="email" id="email">
</span>
<br><br>
<span id="textarea1">
<label for="message">Message: </label>
<textarea name="message" id="message" cols="45" rows="5"></textarea>
</span>
<br><br>
<input type="submit" name="send" id="contactsend" value="Submit">
</form>
Any help would be wonderfull!