Link to home
Start Free TrialLog in
Avatar of vrmetro
vrmetroFlag for United States of America

asked on

elseif ($_SESSION['country'] == 'br') need multiple values where br is

Is it possible to have multiple values where I have my "br"?

elseif ($_SESSION['country'] == 'br'){

tried: elseif ($_SESSION['country'] == 'br,mx,nl')

But doesn't work.  Thank you
Avatar of GarbsTheTurtle
GarbsTheTurtle
Flag of United States of America image

Try:

elseif(in_array($_SESSION['country'],array('br','mx','nl'))
Avatar of vrmetro

ASKER

tried it and did not work, thanks though.
Avatar of vrmetro

ASKER

a little more clarification,

these are outputing information submitted on a previous form with the values stored in the session; see code below, I would like to not have 3 different elseif echos and use the same elseif for de, fr, and nl which are the values of three different countries submitted on the previous form, only one will be stored in the session.  
			elseif ($_SESSION['country'] == 'de'){
			 echo
            	"You'll need a phone with GPS on a GSM Network<br />
				<div id=\"plans\">
			 <div class=\"plan_left\">
				<p class=\"notice\">
     				<input type=\"checkbox\" name=\"plan\" id=\"plan\" value=\"12.95_eu\" /><img src=\"images/spacer.gif\" width=\"15\" height=\"1\">
					Unlimited &euro;12.95/month<br />
					<img src=\"images/spacer.gif\" width=\"1\" height=\"10\"><br />
					<span class=\"sm-text\">Use as much as you'd like - This plan includes<br />
					Location History: See current location and history<br />
					Speeding Alerts: Customize</span><br />
   				</p>
			 </div>
			 <div class=\"plan_right\">
			 	<img src=\"images/blackberry_w_target.jpg\" width=\"111\" border=\"0\" />
			 </div>
        	</div> 
			<br />";
			} //end div

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of GarbsTheTurtle
GarbsTheTurtle
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vrmetro

ASKER

This line works:
elseif ($_SESSION['country'] == 'DE'||$_SESSION['country'] == 'NL'){
echo //somecode
}

This one does too, but still only for DE and NL, FR does not work for some reason:
elseif ($_SESSION['country'] == 'DE'||$_SESSION['country'] == 'NL'||$_SESSION['country'] == 'FR'){
echo //somecode
}

                  
Avatar of vrmetro

ASKER

Scratch that, it does work.  Was access in wrong test space.  Thank you for your help though, if there is a cleaner way to do this using in_array I'd very much like to know how.  If not, I'll wait a few hours and assign points for your help.  thank you!
Avatar of vrmetro

ASKER

I'd like to find out how to use the in_array command to accomplish the same goal if possible.  thanks.