and when you click send a pop up window comes up saying if it has sent successfully or not. thats all i want to happen but at the moment the pop up window comes up and in the window from where the user presses send it goes to the php page the action calls, how do i stop that window going to the php page and just have a pop up window come up?
form code:
<form method="post" class="contact-form" action="php/callback.php" >
<input name="name" type="text" id="formbox" value="Name" onfocus="(this.value == 'Name') && (this.value = '')" onblur="(this.value == '') && (this.value = 'Name')"/><br />
<input name="number" type="text" id="formbox" value="Number" onfocus="(this.value == 'Number') && (this.value = '')" onblur="(this.value == '') && (this.value = 'Number')"/><br />
<input type="submit" value="Send" id="formbutton">
</form>
php code:
<?php
$name = $_POST['name'];
$number = $_POST['number'];
$to = "email@email.co.uk";
$subject = "Call Back Enquiry";
$message = "Hi Raymond, someone that came to your website wants you to call them back, their name is '$name' and their number is '$number'";
$from = "Your Website";
$headers = "From:" . $from;
$send_contact = mail($to,$subject,$message,$headers);
if($send_contact){
echo "<script>alert('We will contact you shortly');</script>";
}
else {
echo "<script>alert('Something went wrong, try again!');</script>";
}
?>