Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/146534-solved-basic-syntax-help/
Share on other sites

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.