我试图创建一个简单的页面,用户在点击“提交”后可以看到他的格式化输入(它在应该发送的电子邮件中的样子)在以前的HTML表单上。使用php的表单验证页面
因为我也想用这个网站的格式化表单数据作为6种不同表单的最终“手动验证”点,所以只有当用户点击提交按钮时才会发送包含表单中所有数据的电子邮件只在本网站上。
我在这个网站上显示用户输入没有问题,但是,似乎我有变量的范围问题。
我正在运行提交按钮的if语句之后,如果是显示来自上一个站点的用户输入。但是,即使将$ content声明为全局,它仍然是空的。也许这也是因为其他if语句这次没有运行。
有没有办法在其他if语句中使用$ content?还是有更漂亮的解决方案?
我对PHP很陌生,这是我尝试过的第一个php项目,所以有些输入真的很感谢。
<?php
require ('/scripts/PHPMailer-master/PHPMailerAutoload.php');
if (isset($_POST['new_mailbox']))
{
// new Mail Form Data
$Name_Applicant = $_POST['Name_Applicant'];
$FirstName_Applicant = $_POST['First_Name_Applicant'];
$email_Applicant = $_POST['email_Applicant'];
$Telephone_Applicant = $_POST['Telephone_Applicant'];
$head = "<h1>Please check your data before submitting the request</h1>";
$part_one = "
<table class=\"pdf_table\" border=\"1\">
<tr><td class=\"table_header\" colspan=\"2\"><b><u>Applicant</u></b></td></tr>
<tr class=\"odd\"><td class=\"first\">Name:</td><td>".$Name_Applicant."</td></tr>
<tr class=\"even\"><td class=\"first\">First Name:</td><td>".$FirstName_Applicant."</td></tr>
<tr class=\"odd\"><td class=\"first\">eMail:</td><td>".$email_Applicant."</td></tr>
<tr class=\"even\"><td class=\"first\">Telephone Number:</td><td>".$Telephone_Applicant."</td></tr>
</table>";
$part_two = "";
echo $head;
if (isset($part_one)){$content.=$part_one;}
if (isset($part_two)){$content.=$part_two;}
if (isset($part_three)){$content.=$part_three;}
if (isset($part_four)){$content.=$part_four;}
if (isset($content)){echo $content;}
echo "
<form method=\"POST\">
<input name=\"form_eMail8\" type=\"hidden\">
<input name=\"form_OK\" type=\"submit\" value=\"OK\">
</form>
";
}
if(isset($_POST["form_OK"]))
{
$CSS = file_get_contents('form.css');
$html = '<style>'.$CSS.'</style>';
$html .= "{$content}";
}
?>
你能向我们展示了''