![](/img/trans.png)
[英]Why when I'm trying with same credential on postman isn't working but when in vanilla html form it works
[英]I'm trying to check a form's input to make sure the fields aren't blank or contain specific words. Anyone know why this code isn't working?
这是表单发布到的“ contactprocess.php”文件:
$result = "";
foreach ($_POST as $key => $val) {
if(($val != "") || (strpos($val,'http') == false) || (strpos($val,'seo') == false)){
$result = "clear" ;
}
}
if ($result == '') {
header("location: contact.php");
}
该代码将忽略“ header(“ location:contact.php”);“ 行并继续执行脚本的其余部分。 这怎么写呢?
在尝试重定向的if分支中,您需要exit;
以防止脚本继续执行:
if ($result == '')
{
header("location: contact.php");
exit;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.