I have my form set up and the jquery written but I've have no idea what to write for the PHP that should be in mail.php.
Any help would be awesome
HTML:
<form id="contact-form" action="mail.php" method="GET">
<fieldset>
<label for="email">Email</label>
<input type="email" name="email" id="email" required="">
</fieldset>
<fieldset>
<label for="enquiry">Message</label>
<textarea name="enquiry" id="enquiry" width="100%" height="100px" required=""></textarea>
</fieldset>
<fieldset>
<input type="submit" name="submit" value="Submit Enquiry">
</fieldset>
</form>
JQUERY:
$(document).ready(function(){
$("#contact-form").submit( function (){
$.getJSON('mail.php',$(this).serialize(), function(data) {
if(data['success'] == 1)
{
$('#contact-form').html("<p class=\"success\">"+data['message']+"</p>");
}
else
{
alert(""+data['message']+"");
$('#contact-form *').removeClass('error');
for(key in data.errors)
{
$('#'+key).addClass('error');
}
}
});
return false;
});
});
PHP:
?