PHP Sending Mail Contact Form with jQuery AJAX

Today, We want to share with you PHP Sending Mail Contact Form with jQuery AJAX.In this post we will show you PHP Contact Form with jQuery AJAX, hear for floating contact form jquery we will give you demo and example for implement.In this post, we will learn about jquery contact form validation with an example.

PHP Sending Mail Contact Form with jQuery AJAX

There are the Following The simple About PHP Sending Mail Contact Form with jQuery AJAX Full Information With Example and source code.

Also Read This πŸ‘‰   vuejs pass multiple parameters to $http post

As I will cover this Post with live Working example to develop jQuery Contact Form PHP Sending Mail with AJAX, so the some major files and Directory structures for this example is following below.

  • index.php
  • contact_mail.php

jQuery AJAX Contact PHP Mail Sending


This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.

#liveContactFrm {border-top:#3d3d3d 2px solid;background:#FAF8F8;padding:10px;}
#liveContactFrm div{margin-bottom: 16px}
#liveContactFrm div label{margin-left: 6px}
.liveTagBox{padding:10px; border:#3d3d3d 1px solid; border-radius:5px;}
.error{background-color: #FF6600;border:#AA4502 1px solid;padding: 6px 10px;color: #FFFFFF;border-radius:5px;}
.success{background-color: #12CC1A;border:#0FA015 1px solid;padding: 6px 10px;color: #FFFFFF;border-radius:5px;}
.dtls{font-size:.8em;color: #FF6600;letter-spacing:2px;padding-left:6px;}
.btnAction{background-color:#2FC332;border:0;padding:10px 40px;color:#FFF;border:#3d3d3d 1px solid; border-radius:5px;}
<script src="" type="text/javascript"></script>
function sendContact() {
	var valid;	
	valid = validateContact();
	if(valid) {
		url: "contact_mail.php",
		type: "POST",
		error:function (){}

function validateContact() {
	var valid = true;	
	if(!$("#memberName").val()) {
		valid = false;
	if(!$("#memberEmail").val()) {
		valid = false;
	if(!$("#memberEmail").val().match(/^([\w-\.][email protected]([\w-]+\.)+[\w-]{2,4})?$/)) {
		valid = false;
	if(!$("#status").val()) {
		valid = false;
	if(!$("#message").val()) {
		valid = false;
	return valid;
<h2>PHP Contact Form with jQuery AJAX</h2>
<div id="liveContactFrm">
<div id="mail-status"></div>
<label style="padding-top:20px;">Name</label>
<span id="memberName-dtls" class="dtls"></span><br/>
<input type="text" name="memberName" id="memberName" class="liveTagBox">
<span id="memberEmail-dtls" class="dtls"></span><br/>
<input type="text" name="memberEmail" id="memberEmail" class="liveTagBox">
<span id="status-dtls" class="dtls"></span><br/>
<input type="text" name="status" id="status" class="liveTagBox">
<span id="message-dtls" class="dtls"></span><br/>
<textarea name="message" id="message" class="liveTagBox" cols="60" rows="6"></textarea>
<button name="submit" class="btnAction" onClick="sendContact();">Send</button>

PHP Sending Contact Mail

I have display this source code when we displaying about simple PHP contact form Example without any jQuery AJAX.

Also Read This πŸ‘‰   Simple Digital Clock Timer with date using C# and


$sendEmail = "[email protected]";
$mailHeaders = "From: " . $_POST["memberName"] . "<". $_POST["memberEmail"] .">\r\n";
if(mail($sendEmail, $_POST["status"], $_POST["message"], $mailHeaders)) {
print "<p class='success'>Contact Mail Sent.</p>";
} else {
print "<p class='Error'>Sorry, Some Problem in Sending Mail.</p>";

PHP Contact Form with jQuery AJAX – Output

Angular 6 CRUD Operations Application Tutorials

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Sending Mail Contact Form with jQuery AJAX.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.