View Full Version : Passing GET parameter strings containing '&'
11-25-2008, 09:19 PM
Im wanting to pass a URL as a parameter to another URL:
Is there a way make the parameter treat the url passed as a single string so that it doesnt interfere with the original URL?
i.e. param = 'http://www.foo.com/test.php?p1=abc&p2=def'
11-25-2008, 09:46 PM
Percent encode the special characters.
11-26-2008, 12:12 AM
I'm kinda a newbie to all coding, so I hope I correctly understand what your looking for, and that my reply is applicable.
Another (PHP) solution I've used is to just pass a single value, then use a switch/case function to interpret that into the multiple values you want.
IE: if you are looking for a date range, you could have a radio button for Last Month, and just have a case that assigns values to the $fromDate and $ toDate vars using the date() function.
An additional bonus is that this creates a more secure form. If someone tried something malicious by customizing the $_GET contents, it couldn't do anything because your switch() func will only utilize pre-defined values in a predefined way.
Just another option.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.