I am trying to figure out a way of updating a variable in a url string.
Say for example i have page.php?action=search&limit=10&n=7
Say i then have a new value for limit. Can i update limit without disrupting the order of the url.
i.e.
page.php?action=search&limit=10&n=7
becomes
page.php?action=search&limit=25&n=7
If i use php_self and add the variable to the url, i get it listed twice and it does not work.
I could do this:
break the url into three sections.
1: the page name
2: variable i want to change,
3: and the rest of the url,
so i get
$page=page.php;
$var1=everything from page.php up to my variable limit, and then $var2=everythin from limit to the end of the url.
I cant get started on this and its frustrating. I know i need some sort of regular expression, or string replace, but i cant get my head round it.
It would be nice just to have string replace the limit=10 or whatever with limit=(my new value).
Sorry for the long post.