I have a page on my website called "email.php" that visitors use to contact me via email. Here is the form element on that page:
<form id="email_form" method="post" enctype="multipart/form-data" action="ssi/emailprocessor.php">
When the HTML form is filled out and submitted, the data is sent to "emailprocessor.php". Here are the contents of that file:
$path_root = "./";
$where_form_is = "http://" . $_SERVER['SERVER_NAME'] . strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
session_start();
if (($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_POST['security_code'])))
{
mail
(
"my@email.com",
"Message from site visitor",
"Name: " . $_POST['field_1'] . "
" .
"Email: " . $_POST['field_2'] . "
" .
"Subject: " . $_POST['field_3'] . "
" .
"Message: " . $_POST['field_4'] . "
" .
"powered by phpFormGenerator" . "
"
);
include($path_root . "captchaconfirmed.php");
}
else
{
include($path_root . "captchafailed.php");
}
How do I make it so that, instead of navigating to a second page, the form in "email.php" instead spawns a dialog box that reports success or failure? Thanks.