PDA

View Full Version : PHP guru's in the house?


Don-Dad
04-05-2006, 06:32 PM
I need help I am trying to send a query string to another PHP script. I can get it working outside the script using a simple echo using the variable

$q = $_GET["q"];

echo "hello $q"

but I have a piece of code and the data needs to be "cleaned removing the %20 but leaving the spaces in the script (I am a newbie to php)

this is part of the line of code

echo GetSearchResults($query=$q, $isEmpty=1, more here....


$q needs to be something like 'Baseball Bat' not 'Baseball%20Bat'

Any assistance is appreciated :)

vertygo
04-05-2006, 09:15 PM
Would this help ?

$q = str_replace("%20", " ", $q);

Jackson's Dad
04-05-2006, 09:57 PM
Where are you getting the value from, a form on another page? If you are using an HTML form to collect and send the data, use POST instead of GET.

vertygo
04-05-2006, 11:16 PM
You might also want to look at urldecode (http://ca.php.net/manual/en/function.urldecode.php)

Don-Dad
04-06-2006, 03:18 AM
not using a form just retrieving the query string from the URL. I'll try some of the suggested and report back :)

Thanks!