I searched the forum and I couldn't find a solution, unless I missed a thread someplace

But what im trying to do is when the submit button is clicked I want to give the status of the form submiting in a div instead of the page refreshing to state the form was submitted.

The same way I have the validate error messages to come up when a field is empty.

PHP Code:
<?php

if ($_POST['submit'] == TRUE) {
    
$receiverMail "****@gmail.com";
    
$name        stripslashes(strip_tags($_POST['name']));
    
$email        stripslashes(strip_tags($_POST['email']));
    
$company        stripslashes(strip_tags($_POST['company']));
    
$phone        stripslashes(strip_tags($_POST['phone']));
    
$subject    "Form";
    
$message        stripslashes(strip_tags($_POST['message']));
    
$ip            $_SERVER['REMOTE_ADDR'];
    
$date    date("YmdGis");
    
$time    date("G:i:s");
    
$msgformat    "
From: 
$name\nEmail: $email

Date: 
$date\nTime: $time

Company: 
$company\nTelephone: $phone\nIP: ($ip)
$message";

    if(empty(
$name) || empty($email) || empty($message)) {
        echo 
"<h2>The email was not sent</h2><p>Please fill all the required fields</p>";
    }
    elseif(!
ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email)) {
        echo 
"<h2>The email was not sent</h2><p>The email address is invalid</p>";
    }
    elseif(
mail($receiverMail$subject$msgformat"From: $name <$email>")) {
        echo 
"<h2>The email has been sent!</h2><p>I will get back to you as soon as possible.</p>"; }
    else {
        echo 
"<h2>The email was not sent</h2><p>Please try again... If the problem continues there's probably something wrong with the server.</p>";
    }
// send copy of email to visitor
mail(
"$name <$email>",
"Autoresponse Notification"
"
From: 
$name\nEmail: $email

Date: 
$date\nTime: $time

Company: 
$company\nTelephone: $phone\nIP: ($ip)

$message""From: <****@gmail.com>");
}
?>


Code:
<script language="JavaScript" type="text/javascript">
	function validateForm() {
		success=true;

		errorObj=document.getElementById('nametxterror')
		if (document.forms.emailform.name.value=="") {
			errorObj.innerHTML="Please enter your name.";
			success=false;
		} else {
			errorObj.innerHTML="";
		}

		errorObj=document.getElementById('emailtxterror')
		if (document.forms.emailform.email.value=="") {
			
			errorObj.innerHTML="Please enter your email.";
			success=false;
		} else {
			errorObj.innerHTML="";
		}
		
		errorObj=document.getElementById('messagetxterror')
		if (document.forms.emailform.message.value=="") {
			errorObj.innerHTML="Please enter a message.";
			success=false;
		} else {
			errorObj.innerHTML="";
		}
		

		
		return success;
	}
</script>
Code:
		<div id="nametxterror"></div>
		<div id="emailtxterror"></div>
		<div id="messagetxterror"></div>

	<div id="form_contact">

  
	
	<form action="" method="post" id="emailform" onSubmit="return validateForm()">
	  	  <div class="input" style="float:left; width:175px;"><label class="contactyourname" for="name"><span>Name</span></label><input name="name" type="text" class="textfield"  id="name"  /></div>
	  <div class="input" style="float:right; width:175px;"><label class="contactcompanyname" for="company"><span>Company Name</span></label><input name="company" type="text" class="textfield"  id="company"  /></div>
	  	  <div class="input" style="float:left; width:175px;"><label class="contactemail" for="email"><span>Email</span></label><input name="email" type="text" class="textfield"  id="email"  /></div>
	  <div class="input" style="float:right; width:175px;"><label class="contacttelephone" for="phone"><span>Telephone</span></label><input name="phone" type="text" class="textfield"  id="phone" MAXLENGTH="7" /></div>
	  <div class="clear"></div>

		<div style="float:left;" class="input"><label class="contactmessage" for="message"><span>Message</span></label><textarea name="message" style="width:320px; height:100;"></textarea></div>

		<div style="float:right;" class="submit"><INPUT class="submit" id="send" title="Send" type="image" src="images/send.jpg" value="Submit Form" name="submit" id="submit"></div>
	</form>

		</div>