Page 1 of 1

Passing strings from submitted forms into PHP script

Posted: Thu Nov 11, 2004 12:48 am
by Ham
When I tried something like:

products.php?productType=Portable Electronics

... $productType ended up being "Portable%20Electronics" in products.php

The whitespace has been replaced by this %20 ascii value. I can't find a way to strip that character to get the intended text back. I can 'circumvent' the problem, but I don't want to add more unneccessary code. Please help!

Posted: Thu Nov 11, 2004 2:34 am
by CoderGoblin
You need to look up URLENCODE and URLDECODE commands in PHP...
Encode the string before you send it and decode on the destination.