Passing strings from submitted forms into PHP script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ham
Forum Newbie
Posts: 1
Joined: Thu Nov 11, 2004 12:33 am

Passing strings from submitted forms into PHP script

Post 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!
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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.
Post Reply