cooldude832 Posted May 17, 2007 Share Posted May 17, 2007 I'm trying to create a search result page. with the url that has someone.com/serach.php?critera1=sometihg&critera2=something&limit=0 Limit is what sets which part of the matching results it will display. This script works great if I manually set limit by using my mouse in the url and changing it to 1,2,3,4,5,etc etc, but I want to change it dynamically so that I can say: previous 1 2 3 4 5 6 7 8 9 10 next and those be links to pages where Limit is equal to what ever number they are. Is there a simple way to change limit with out having to explode the url string apart chopping it down to just limit=n or limit=nn and then chop limit=n/limit=nn at the = and implode the whole url back together? Link to comment https://forums.phpfreaks.com/topic/51900-how-can-i-replace-the-value-of-a-get-var-in-the-url/ Share on other sites More sharing options...
soycharliente Posted May 17, 2007 Share Posted May 17, 2007 Your question confuses me a little bit. Can you provide a more detailed explanation? Link to comment https://forums.phpfreaks.com/topic/51900-how-can-i-replace-the-value-of-a-get-var-in-the-url/#findComment-255851 Share on other sites More sharing options...
cooldude832 Posted May 17, 2007 Author Share Posted May 17, 2007 http://www.me.org/horse/search.php?search=yes&state=&breed=Appaloosa&sex=&orf=&limit=0 that is my url, but i think I got a simple solution i'm going to try this $urlexplode = explode('&limit=',$url); $limit = $urlexplode[1]; $url = $urlexplode[0]; as long as someone don't mess with my url. Link to comment https://forums.phpfreaks.com/topic/51900-how-can-i-replace-the-value-of-a-get-var-in-the-url/#findComment-255854 Share on other sites More sharing options...
hitman6003 Posted May 17, 2007 Share Posted May 17, 2007 all of those variables, and their values, are available in the $_GET superglobal array. Link to comment https://forums.phpfreaks.com/topic/51900-how-can-i-replace-the-value-of-a-get-var-in-the-url/#findComment-255866 Share on other sites More sharing options...
cooldude832 Posted May 17, 2007 Author Share Posted May 17, 2007 I know that , but my issue is not retriving its value, but replacing its value in a new url if i'm on http://www.me.org/horse/search.php?search=yes&state=&breed=Appaloosa&sex=&orf=&limit=0 i want to have a link to http://www.me.org/horse/search.php?search=yes&state=&breed=Appaloosa&sex=&orf=&limit=1 http://www.me.org/horse/search.php?search=yes&state=&breed=Appaloosa&sex=&orf=&limit=2 http://www.me.org/horse/search.php?search=yes&state=&breed=Appaloosa&sex=&orf=&limit=3 etc. Link to comment https://forums.phpfreaks.com/topic/51900-how-can-i-replace-the-value-of-a-get-var-in-the-url/#findComment-255867 Share on other sites More sharing options...
kenrbnsn Posted May 17, 2007 Share Posted May 17, 2007 Take a look at the function http_build_query(). I think it will help you solve your problem. Ken Link to comment https://forums.phpfreaks.com/topic/51900-how-can-i-replace-the-value-of-a-get-var-in-the-url/#findComment-255906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.