teknojunkey Posted February 23, 2009 Share Posted February 23, 2009 hi , can anyone advise me on how to get this right, i want to add an if statement. print_r ($_SESSION['submitted'][30]['other'] ); //if this has a value echo "choice 1"; print_r ($_SESSION['submitted'][31]['other'] ); //if this has a value echo "choice 2"; print_r($session); this is what i get with one form filled in: [30] => Array ( [other] => ) [31] => Array ( [other] => 70MM ) thanks any book / pdf recomendations on php basics? Quote Link to comment https://forums.phpfreaks.com/topic/146534-solved-basic-syntax-help/ Share on other sites More sharing options...
JonnoTheDev Posted February 23, 2009 Share Posted February 23, 2009 if(strlen($_SESSION['submitted'][30]['other'])) { echo "choice 1"; } if(strlen($_SESSION['submitted'][31]['other'])) { echo "choice 2"; } If you have many array keys i.e. 30,31,32,33, etc then you may want to run through a loop Quote Link to comment https://forums.phpfreaks.com/topic/146534-solved-basic-syntax-help/#findComment-769283 Share on other sites More sharing options...
teknojunkey Posted February 23, 2009 Author Share Posted February 23, 2009 thanks Quote Link to comment https://forums.phpfreaks.com/topic/146534-solved-basic-syntax-help/#findComment-769309 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.