Gosh, that title was a bit of a mouthful.
Basically my question is quite hard to explain due to my bare knowledge of PHP but I have a contact form that once the submit button has been pressed, processes through an engine, then redirects to a confirmation page if all has worked out.
This confirmation page is a html document that is literally a h1 tag with some text, what I would like to do is have a confirmation show up on the original page with the contact form on it as a javascript notification (a NotifyJS type one)
My file structure: contact form: contact.html > contactengine.php (if no errors) > contactthanks.php
Here is the code
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
Here is the plugin I want to use for the error https://notifyjs.com/
This is my confirmation notification, that I want the contactthanks.php message to show up on (on the original page)
$.notify("Email sent succesfully");
Thanks in advance, been trying heaps of different things but I'm just getting nowhere, can't find any answers that make sense to me also.
The flow does not seem clear.
You want a notification on the form page but you wouldn't see it because you are forwarded to either "thankyou" or "error".
I don't know exactly what you want but perhaps you want to fire the form through AJAX (which would execute it in the background and you stay on the form page) and then show the result (error or thankyou) in a notification.