At the code below, when users click submit, it will redirect users to the page mywebsite/form-to-email.php
But the thing I am looking for is when users click submit button, it just show a simple popup (5 seconds) to inform users something like "We have received your information". So how should I make that happen?
Here is my HTML Contact Form.
<form action="/wp-content/themes/writee/templates/form-to-email.php" method="POST">
<ol>
<li>How would you like me to call you? <input name="name" type="text" placeholder="Big Jack" /> </li>
<li>Pick Up Address
<ul> <li style="list-style-type: none;"></li>
<li>Number and Street or Site Name <input type="text" name="pickupadd" placeholder="5600 American Dr or Toronto Pearson Airport Terminal 3"/> </li>
<li>Post Code <input type="text" name="pickuppc" placeholder="L4W 1S9" /></li>
</ul>
</li>
<li>Drop Off Address
<ul>
<li>Number and Street or Site Name <input type="text" name="dropoffadd" placeholder="40 Bay Street or Air Canada Centre"/> </li>
<li>Post Code <input type="text" name="dropoffpc" placeholder="M5J 2X2"/> </li>
</ul>
</li>
<li>Your Contact
<ul>
<li>Phone Number <input type="number" name="phonenumber" placeholder="1 416 123 4567" /></li>
<li>Email <input type="email" name="useremail" placeholder="youremail@gmail.com"/> </li>
</ul>
</li>
</ol>
Message
<textarea style="height: 200px" name="message" placeholder="Anything I should know such as how big your"></textarea>
<input type="submit" value="send"/>
</form>
And here is my .php contact form
<?php
$name = $_POST['name'];
$pickupadd = $_POST['pickupadd'];
$pickuppc= $_POST['pickuppc'];
$dropoffadd= $_POST['dropoffadd'];
$dropoffpc= $_POST['dropoffpc'];
$phonenumber= $_POST['phonenumber'];
$useremail = $_POST['email'];
$message = $_POST['message'];
$formcontent=" From: $name \n Pick Up Address: $pickupadd \n Pick Up Post Code: $pickuppc\n Drop Off Address: $dropoffadd\n Drop Off Post Code $dropoffpc\n Fone Number: $phonenumber\n Email: $useremail\n Message: $message";
$recipient = "admin@mydomain.com";
$subject = "Pickup Request";
$headers = "Bcc: myemail@gmail.com";
mail($recipient, $subject, $formcontent,$headers) ;
echo "Thank You!";
?>