gevo12321 Posted December 12, 2008 Share Posted December 12, 2008 is it possible to put 2 arguments in an if statement or would i have to put an if statement within another if statement. for example could i do the following? if so what would be the code? if the carpet is blue and the chair is red then bla or do i have to if the carpet is blue then if the chair is red then bla Link to comment https://forums.phpfreaks.com/topic/136731-solved-if-statments/ Share on other sites More sharing options...
ted_chou12 Posted December 12, 2008 Share Posted December 12, 2008 if ($carpet == "blue") {echo "blue blah";} elseif ($carpet == "red") {echo "red blah";} Link to comment https://forums.phpfreaks.com/topic/136731-solved-if-statments/#findComment-714047 Share on other sites More sharing options...
ngreenwood6 Posted December 12, 2008 Share Posted December 12, 2008 You could do this: if(($carpet == "blue") && ($chair == "red")) { do this } Both of those values would have to be true for it to do it tho. Link to comment https://forums.phpfreaks.com/topic/136731-solved-if-statments/#findComment-714052 Share on other sites More sharing options...
gevo12321 Posted December 12, 2008 Author Share Posted December 12, 2008 thank you Link to comment https://forums.phpfreaks.com/topic/136731-solved-if-statments/#findComment-714055 Share on other sites More sharing options...
dennismonsewicz Posted December 12, 2008 Share Posted December 12, 2008 i would also read up on your comparison operators http://us3.php.net/operators.comparison Link to comment https://forums.phpfreaks.com/topic/136731-solved-if-statments/#findComment-714057 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.