Jump to content

IF.....Else Statement


maliary

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.