Canman2005 Posted March 14, 2006 Share Posted March 14, 2006 Hi allIs there a way to do two if statements? Currently I use[code]<? if ("".$_POST['gender']."" == 'male') { print "male"; }?>[/code]Can a sql statement be written to something like below[code]<? if ("".$_POST['gender']."" == 'male' & "".$_POST['age']."" == '11') { print "male"; }?>[/code]So as well as checking the gender, I can also check the age?Thanks in advanceEd Link to comment https://forums.phpfreaks.com/topic/4898-two-if-statements/ Share on other sites More sharing options...
k.soule Posted March 14, 2006 Share Posted March 14, 2006 [code]IF ( (ARGUMENT is TRUE) && (ARGUMENT2 is TRUE) ) { // evaluate}[/code]&& is AND|| is OR Link to comment https://forums.phpfreaks.com/topic/4898-two-if-statements/#findComment-17243 Share on other sites More sharing options...
kenrbnsn Posted March 14, 2006 Share Posted March 14, 2006 Why are you using this contruct:[code] <?php if ("".$_POST['gender']."" == 'male') { print "male"; }?>[/code]when this will work just as well:[code]<?php if ($_POST['gender'] == 'male') { print "male"; }?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/4898-two-if-statements/#findComment-17244 Share on other sites More sharing options...
Canman2005 Posted March 14, 2006 Author Share Posted March 14, 2006 Thanks everyone Link to comment https://forums.phpfreaks.com/topic/4898-two-if-statements/#findComment-17248 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.