<?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