aerophilia Posted May 30, 2008 Share Posted May 30, 2008 Hi, php newb here. Quick "easy" question for you. It has been hurting my head this last hour. What I want to do: if my URL has "?country_id=2" have my text appear on the page. if(!isset($_GET['country_id'])){ if($country_id=="2"){ echo $europe_austria_txt; } } for further information here's "$europe_austria_text" $europe_austria_txt=" <br /> Here will be some great text about the wonderful place they call Austria<br /> "; Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted May 30, 2008 Share Posted May 30, 2008 1.) You dont need the ! sign. That makes the statement read the opposite to what you want. 2.) Unless you extracted $country_id from the URL previously, then that is unset. 3.) You can do it all with one if statement: if(isset($_GET['country_id']) && $_GET['country_id'] == 2){ echo $europe_austria_txt; } Also, if you enclose your string in double quotes, then you can use \n to make a new line, rather than spreading it across multiple lines: $europe_austria_txt="\n<br />Here will be some great text about the wonderful place they call Austria<br />\n"; Quote Link to comment Share on other sites More sharing options...
aerophilia Posted May 30, 2008 Author Share Posted May 30, 2008 Thanks Ben thats perfect. I can see exactly where I was going wrong there now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.