Jump to content

Recommended Posts

 

Hi people,

 

I have the following if....else statement

 

 

 

              $display=explode('&',$stored_request['material']);  //This is an array 

             $cnt=count($display); // This counts the number of array items
     
             //iterate through the array to get the array values

   foreach ($display as $x => $y)  
     { 
       if ($y=='_mx_tb_=1')      // This is option 1
    {          
     $tb='';
    }

    // Urine Culture and Urinalysis
    elseif ($y=='_mx_urin_=1' || $y=='_mx_urincul_=1')
    {
     $urine ='';
    }
    
    // Pleural Fluid 
    elseif  ($y=='_mx_pleural_=1')
    {  
     $pleural ='';
    }
elseif ($y=='_mx_earswab_=1')     // This is option 2
    {
     $earswab ='';
    }

    
    }
     // skin 
    elseif  ($y=='_mx_skinscrap_=1' || $y=='_mx_skinscrapcs_=1')
    {
    
     $skin ='';
     if ($y=='_mx_skinscrapcs_=1')
     {
         $skincs='';
     }
   }

    }

//Then I check the if the values are set

//SECTION B

if(isset ($tb))  // Part 1
{ 
  echo 'a';
}
elseif (isset ($pleural)) //Part 2
{
echo 'b';
}
elseif (isset ($earswab)) // Part 3
{
echo 'c'; 
}

The Problem: If I have Option 1 and 2 as true in section b only Part 1 will show, part 3 is left out. Why is this happening?


Link to comment
https://forums.phpfreaks.com/topic/86271-ifelse-statement/
Share on other sites

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.