2011-10-26 14 views
0

私は少しでも練習用のメールフォームを作っています。全体の配列

私は私がどのように

$nomail = array("[email protected]","[email protected]"); 
if($_POST["to"]!=$nomail) 
    mail($_POST["to"],$_POST["subject"],$_POST["message"],$headers); 
else 
    echo "Not Allowed To Email That Email"; 

、に電子メールで送信するカントのメールの配列を作りたいですか?

答えて

4

あなたが探しているのはin_arrayです。

if (!in_array($_POST["to"], $nomail)) { 

http://us3.php.net/in_array

+0

のおかげでラインif($_POST["to"]!=$nomail)! – Hego555

1
$nomail = array('[email protected]', '[email protected]'); 

if (!in_array($_POST['to'], $nomail)) { 
    mail($_POST["to"],$_POST["subject"],$_POST["message"],$headers); 
} else { 
    echo 'Not Allowed To Email That Email'; 
} 
関連する問題