Isterklister Posted May 6, 2009 Share Posted May 6, 2009 Hello, I have two links in the top of the page (where you can select language). If I click on one of them I want the page to reload with new argument (GET), ex <a href='XXXXXXX?lang=2'>Language1</a> <a href='XXXXXXX?lang=1'>Language2</a> where XXXXXXX should be replaced with some code that call itself. How could I do this? I will not set the filename instead of XXXXXXX because I use the top of the site on every pages. I can probably set a variable with the file name in the top of the script but are there a smoother way to do this? / new idé I can send the arguments via POST but I still needs a function to reload the page. Thanks Pelle Quote Link to comment https://forums.phpfreaks.com/topic/157135-solved-reload-page-with-new-arguments/ Share on other sites More sharing options...
Ken2k7 Posted May 6, 2009 Share Posted May 6, 2009 Set it to the file name itself? Quote Link to comment https://forums.phpfreaks.com/topic/157135-solved-reload-page-with-new-arguments/#findComment-827935 Share on other sites More sharing options...
Maq Posted May 6, 2009 Share Posted May 6, 2009 where XXXXXXX should be replaced with some code that call itself. How could I do this? I think you're looking for: ?lang=2'>Language1 Quote Link to comment https://forums.phpfreaks.com/topic/157135-solved-reload-page-with-new-arguments/#findComment-827937 Share on other sites More sharing options...
Isterklister Posted May 6, 2009 Author Share Posted May 6, 2009 Thank you! Thats perfect. I have some problem with ' and " in the php code. echo "<a href='$_SERVER['PHP_SELF']?lang=2'>Language2</a>"; will return some errors and that is understandable, but how would I solve this? /Pelle Quote Link to comment https://forums.phpfreaks.com/topic/157135-solved-reload-page-with-new-arguments/#findComment-827946 Share on other sites More sharing options...
Maq Posted May 6, 2009 Share Posted May 6, 2009 You have to concatenate it to the string by breaking out of the string. echo "Language2"; I believe you can just use curly braces to escape the single quotes in the array as well: echo "Language2"; Quote Link to comment https://forums.phpfreaks.com/topic/157135-solved-reload-page-with-new-arguments/#findComment-827962 Share on other sites More sharing options...
Isterklister Posted May 6, 2009 Author Share Posted May 6, 2009 I just got the same solution. Thanks anyway. /Pelle Quote Link to comment https://forums.phpfreaks.com/topic/157135-solved-reload-page-with-new-arguments/#findComment-827967 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.