我有一个基本表单,它要求提供某些信息,然后在实际将其提交到单独的 php 文件以通过电子邮件将表单提交给我之前使用 javascript 验证表单但是,在成功提交表单后,它会转到空白页,然后是谢谢你弹出窗口出现。如何设置它以便点击提交按钮不会转到新页面,而只会在当前页面上显示弹出窗口?
我填写表格的代码是:
<form action="send_group.php" method="post" onsubmit='return formValidator()'>
//Asks to input information
<input type="submit" value="Submit" />
</form>
我的 PHP 代码是:
<?php
$webmaster_email = "email@email.com"; //E-mail the message will be sent to
$info = $_REQUEST['info'] ;
$info1= $_REQUEST['info1'] ;
$info2= $_REQUEST['info2'] ;
$info3= $_REQUEST['info4'] ;
mail( "$webmaster_email", "Information Form Submission",
"Info: $info
Info1: $info1
Info2: $info2
Info3: $info3" );
echo "<script type='text/javascript'>\n";
echo "alert('Thank you for your booking request. We will get back to you as soon as possible.');\n";
echo "</script>";
?>