ngreenwood6 Posted October 13, 2008 Share Posted October 13, 2008 I understand how to put something into the url through get <a href="index.php?sort=desc">Descending</a> The part I dont get is how do I make it universal so that I dont have to know what is going to be there already. For example if I want to add a page number to the end of this row i would do it like this: <a href="index.php?sort=desc&page=1">Descending</a> Now say for instance I didn't know what the url was going to be other than the fact that it was going to be index.php. How would I go about doing that? And if it was the first variable it would be with a ? instead of the & how can I make it know that it is going to be that? Any help or links are appreciated. And please can someone make it easy to understand because I am a noob. Link to comment https://forums.phpfreaks.com/topic/128222-solved-_get/ Share on other sites More sharing options...
MadTechie Posted October 13, 2008 Share Posted October 13, 2008 to get the QUERY_STRING use $_SERVER['QUERY_STRING'] or each key/value use foreach($_GET as $K => $V) { echo "Key:$K = $V<br>"; } to append to the existing URL try $Q= (!empty($_SERVER['QUERY_STRING'])?"?":$_SERVER['QUERY_STRING']."&"; //add SORT=ASC echo $Q."SORT=ASC"; Link to comment https://forums.phpfreaks.com/topic/128222-solved-_get/#findComment-664077 Share on other sites More sharing options...
ngreenwood6 Posted October 13, 2008 Author Share Posted October 13, 2008 I think that you have got it now. thanks for the help. I will try it out. Link to comment https://forums.phpfreaks.com/topic/128222-solved-_get/#findComment-664094 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.