Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Is there opposite to HTTP::setGetVar?


Go to End


2 Posts   2019 Views

Avatar
Hammy

Community Member, 49 Posts

9 May 2009 at 10:57am

I'm trying to do the reverse of HTTP::setGetVar, is there a method that instead of adds a variable to a url but instead removes a variable.

Example:
URL = /page-name/?var1=something&var2=somethingelse

Is there a method that will remove var1=something from the URL and return /page-name/?var2=somethingelse

Avatar
bummzack

Community Member, 904 Posts

10 May 2009 at 7:15pm

Hi

There's always the http_build_query function (http://php.net/manual/en/function.http-build-query.php). To extract the variables from a query string, use the parse_str function (http://php.net/manual/en/function.parse-str.php)