...

View Full Version : getting plus (+) symbols in query string



rockdoc
06-10-2007, 03:15 PM
Hello,
I'm trying to grab a query string value for "search" where there are multiple values separated by plus symbols

e.g. index.php?search=one+two+three


in index.php I have the following

$action = $_GET['search'];

and I use this to do this

require("http://www.mysite.com/cgi-bin/search.pl?search=$action");

It works fine if there is only one search term. However when there is more than one the "require" breaks because it replaces the "+" with a blank space

require("http://www.mysite.com/cgi-bin/search.pl?search=one"); (works)

require("http://www.mysite.com/cgi-bin/search.pl?search=one two three"); (does not work)

Is there a simple solution?

CFMaBiSmAd
06-10-2007, 03:53 PM
The urlencode() function will probably do what you want.

rockdoc
06-10-2007, 11:44 PM
Thankyou CFMaBiSmAd,
That was a simple solution!

$action = urlencode($action);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum