I’ve been looking around for solutions to a particular issue I’m having with a PHP script I’m trying to re-purpose.
<?php $name = $_POST['name'];
$company = $_POST['company'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent = "$name \nMessage: $message";
$recipient = "me@me.com";
$subject = "Contact Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die ("Error!");
echo "Thank You!" . " -" . " <a href = '../index.html' style = 'text-decoration:none;color:#ff0099;'>Return Home</a>";
?>
Instead of re-directing to another page, I’m keen to understand a clean way of just initiating a confirmation via modal pop-up instead.
I’m running the script as an external file so I’m guessing there’s half the answer already but in terms of invoking a jQuery plugin to do the rest of the work, I could use a pointer or two!
Or you could use this in the onsubmit attribute
Will ask for ok/cancel confirmation
— jQuery Ajax —–
— and in your form tag —