我正在为我的公司使用HTML并使用PHP处理数字就业应用程序。
表单由以下内容定义:<form method="post" action="./php/post.php" name="empapp">
,文字字段由以下内容定义:<input size="13" name="canyoufeelityeah">
我的PHP页面包含以下行: `print_r($ _POST); print_r($ _POST [“canyoufeelityeah”]);
if (($_POST["canyoufeelityeah"] = ' ') or ($_POST["initials2"] = ' ') or ($_POST["initials3"] = ' ') or ($_POST["initials4"] = ' ') or ($_POST["signature"] = ' '))
{
echo $_POST["canyoufeelityeah"]."|".$_POST["initials2"]."|".$_POST["initials3"]."|".$_POST["initials4"]."|".$_POST["signature"]."|";
echo "You must initial each of the 4 blocks and sign your name at the bottom. <br />You will be redirected to your application in 15 seconds...";
// echo "<script>setTimeout(\"window.history.back()\", 1500)</script>";
}`
所有$ _POST变量的打印显示变量“canyoufeelityeah”及其值,但这段代码总是拉空。
任何人都可以帮忙吗?我有大约30个其他变量正在通过,但这一个是唯一一个给我任何问题,我不知道为什么。
谢谢!
答案 0 :(得分:0)
您在assignment
声明中正在执行comparison
而不是if
。
($_POST["canyoufeelityeah"] = ' ')
它应该是:
($_POST["canyoufeelityeah"] == ' ')
答案 1 :(得分:0)
试试这个,我想你忘记了'=='
if (($_POST["canyoufeelityeah"] == ' ') or ($_POST["initials2"] == ' ') or ($_POST["initials3"] == ' ') or ($_POST["initials4"] == ' ') or ($_POST["signature"] == ' '))
{
echo $_POST["canyoufeelityeah"]."|".$_POST["initials2"]."|".$_POST["initials3"]."|".$_POST["initials4"]."|".$_POST["signature"]."|";
echo "You must initial each of the 4 blocks and sign your name at the bottom. <br />You will be redirected to your application in 15 seconds...";
// echo "<script>setTimeout(\"window.history.back()\", 1500)</script>";
}`
答案 2 :(得分:0)
试试这个。
if (empty($_POST["canyoufeelityeah"]) or empty($_POST["initials2"]) or empty($_POST["initials3"]) or empty($_POST["initials4"]) or empty($_POST["signature"]))
{
echo $_POST["canyoufeelityeah"]."|".$_POST["initials2"]."|".$_POST["initials3"]."|".$_POST["initials4"]."|".$_POST["signature"]."|";
echo "You must initial each of the 4 blocks and sign your name at the bottom. <br />You will be redirected to your application in 15 seconds...";
// echo "<script>setTimeout(\"window.history.back()\", 1500)</script>";
}