ShaolinF Posted November 30, 2009 Share Posted November 30, 2009 Hi Guys Say I have a URL as follows: www.mysite.com/?f=all Now, if the user clicks on the next page I want to carry this variable so the link would be: www.mysite.com/?f=all&p=2 What is the best approach to doing this ? Link to comment https://forums.phpfreaks.com/topic/183495-adding-vars-to-existing-strings/ Share on other sites More sharing options...
cags Posted December 3, 2009 Share Posted December 3, 2009 One method would be to use $_SERVER['QUERY_STRING'] to append the current values, but it's probably not the best, you'd need to do some check though to check your values so for example you don't end up with ?p=1&p=2. Also you could of course use... if(isset($_GET['value'])) { $url .= "value=$something"; } I swear there's a simpler way of doing it, but it's currently escaping me. Link to comment https://forums.phpfreaks.com/topic/183495-adding-vars-to-existing-strings/#findComment-970368 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.