<?php
if (isset($_POST['ign'], $_POST['email'])) {
if($_POST['ign'] && $_POST['email']){
}
else {
echo ("Please enter all of the values!");
}
}
else {
echo ("Error in form data!");
}
if((FILTER_VALIDATE_EMAIL($_POST['email'] == TRUE))) {
$email = $_POST['email'];
echo ("Thanks, " . htmlentities($_POST['ign']) . ", you will recieve an email when the site is complete!");
}
else {
echo "Failure!";
}
// insert email and ign into database
?>
这会正常工作吗?第一次完全从头开始做一些事情!验证电子邮件错误
行!我改变了它。那这个呢?我还应该做空吗?
<?php
if (!isset($_POST['ign'], $_POST['email'])) {
if($_POST['ign'] && $_POST['email']){
echo "Please fill out all of the fields!";
die;
}
if(var_filter($_POST['email'], FILTER_VALIDATE_EMAIL))
$email = $_POST['email'];
echo ("Thanks, " . htmlentities($_POST['ign']) . ", you will recieve an email when the site is complete!");
}
else {
echo "Your email was invalid!";
}
// insert email and ign into database
?>
+1用于查看第一次尝试验证的过滤器函数! – cmbuckley 2012-01-10 00:49:42
不,它不会起作用。但在你问它是否确实如此之前,你应该执行代码并尝试修复它返回的错误。了解错误并修复它们会大大帮助您未来的编程。 – fivedigit 2012-01-10 00:49:58
[if!isset multiple OR conditions]的可能重复(http://stackoverflow.com/questions/8784584/if-isset-multiple-or-conditions) – 2012-01-10 00:54:07