Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2008-06-11
7
Medium Priority
?
222 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:vrmetro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 16

Expert Comment

by:DrNikon224
ID: 21764727
Try:

elseif(in_array($_SESSION['country'],array('br','mx','nl'))
0
 

Author Comment

by:vrmetro
ID: 21764907
tried it and did not work, thanks though.
0
 

Author Comment

by:vrmetro
ID: 21764936
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

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Accepted Solution

by:
DrNikon224 earned 750 total points
ID: 21765269
Make sure I understand correctly - $_SESSION['country'] will be any ONE of de,fr or nl? And you want to see if $_SESSION['country'] is any one of those values? If this is the case, then in_array() is definitely what you need, we just need to figure out why it's not doing what you expect in your usage.

Are you able to post the whole script here?
0
 

Author Comment

by:vrmetro
ID: 21771112
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
}

                  
0
 

Author Comment

by:vrmetro
ID: 21771143
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!
0
 

Author Closing Comment

by:vrmetro
ID: 31466391
I'd like to find out how to use the in_array command to accomplish the same goal if possible.  thanks.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question