le007 Posted October 11, 2007 Share Posted October 11, 2007 if ( $area == "thisarea" ) { echo "You're home"; } elseif( $price == "100" ) { echo " "; I need an if for both conditions, basically if area is "thisarea" and price is 100 then I want nothing echoed at all. How can this be done? How can I add 2 if's... if a = b and c = d then echo " " Thanks Link to comment https://forums.phpfreaks.com/topic/72856-if-statement/ Share on other sites More sharing options...
Orio Posted October 11, 2007 Share Posted October 11, 2007 if( condition1 && condition2) Meaning- if($area == "thisarea" && $price == "100") && - means AND (both must be true) || - means OR (at least one needs to be ture) Orio. Link to comment https://forums.phpfreaks.com/topic/72856-if-statement/#findComment-367405 Share on other sites More sharing options...
le007 Posted October 11, 2007 Author Share Posted October 11, 2007 Top man, thank you Link to comment https://forums.phpfreaks.com/topic/72856-if-statement/#findComment-367409 Share on other sites More sharing options...
hamza Posted October 11, 2007 Share Posted October 11, 2007 This is my code <body> <?php // # Is the OS Windows or Mac or Linux if (strtoupper(substr(PHP_OS,0,3)=='WIN')) { $eol="\r\n"; } elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) { $eol="\r"; } else { $eol="\n"; } # Common Headers $headers .= 'From: Webdev01 <[email protected]>'.$eol; $headers .= 'Reply-To: Webdev01 <[email protected]>'.$eol; $headers .= 'Return-Path: Webdev01 <[email protected]>'.$eol; $headers .= "Message-ID: <TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters # Boundry for marking the split & Multitype Headers $headers .= 'MIME-Version: 1.0'.$eol; //$headers .= "Content-type: text/plain; charset=iso-8859-1".$eol; $headers .= "Content-type: text/html; charset=iso-8859-1".$eol; $to = "[email protected]"; $subject = "Test Mail"; $msg = "Hi, <br> Testing"; if(mail($to, $subject, $msg, $headers)) echo "mail sent...."; else echo "error..."; ?> </body> Problem : when i was send this kind of code it will show me that mail is send successfully . but in actually mail is not sende. And my php.ini and please tell me about the php.ini file thanks in advance Link to comment https://forums.phpfreaks.com/topic/72856-if-statement/#findComment-367419 Share on other sites More sharing options...
prime Posted October 11, 2007 Share Posted October 11, 2007 you can use && or AND both are the same thing in this case Link to comment https://forums.phpfreaks.com/topic/72856-if-statement/#findComment-367420 Share on other sites More sharing options...
roopurt18 Posted October 11, 2007 Share Posted October 11, 2007 &&, ||, ! are the preferred syntaxes. Link to comment https://forums.phpfreaks.com/topic/72856-if-statement/#findComment-367436 Share on other sites More sharing options...
darkfreaks Posted October 11, 2007 Share Posted October 11, 2007 ^ so true Link to comment https://forums.phpfreaks.com/topic/72856-if-statement/#findComment-367440 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.