-1

希望有人能帮我解决这个问题???

if (isset($_POST['frame_in']) == "yes") && (isset($_POST['collected1']) == "no") {
mail($mailTo,$subject,$message,$headers); 
}

更多信息

当以下情况为真'frames_in' = yes 并且'collected1' = no 时,我试图触发一封自动电子邮件

4

2 回答 2

6

Your logic is wrong. You want to test if the $_POST values are set and equal to "yes" or "no". For example:

(isset($_POST['frame_in']) && $_POST['frame_in'] ==  "yes")

In context of your code with 2 conditions:

if ((isset($_POST['frame_in']) && $_POST['frame_in'] == "yes") 
     && (isset($_POST['collected1']) && $_POST['collected1'] == "no")) {
   mail($mailTo,$subject,$message,$headers); 
}

Your original code was comparing the return value of isset() (boolean TRUE/FALSE) to yes or no, which it would never be.

You also had some incorrect () enclosures and a typo.

When developing, always use error_reporting(E_ALL); and ini_set('display_errors', 1); so that your syntax errors are visible on screen.

于 2012-04-27T14:55:13.343 回答
3

change S_POST to $_POST for a start :)

于 2012-04-27T14:55:50.913 回答