电子邮件表单应该生成对话框而不是新页面

时间:2015-02-03 07:25:42

标签: php

我的网站上有一个名为“email.php”的页面,访问者可以通过电子邮件与我联系。这是该页面上的表单元素:

<form id="email_form" method="post" enctype="multipart/form-data" action="ssi/emailprocessor.php">

填写并提交HTML表单后,数据将发送到“emailprocessor.php”。以下是该文件的内容:

$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'] . "\n" .
        "Email: " . $_POST['field_2'] . "\n" .
        "Subject: " . $_POST['field_3'] . "\n" .
        "Message: " . $_POST['field_4'] . "\n\n" .
        "powered by phpFormGenerator" . "\n"
    );
    include($path_root . "captchaconfirmed.php");
}
else
{
    include($path_root . "captchafailed.php");
}

如何制作它,而不是导航到第二页,“email.php”中的表单会生成一个报告成功或失败的对话框?感谢。

0 个答案:

没有答案