$_GET problem

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
sk8erh4x0r
Forum Commoner
Posts: 43
Joined: Wed May 26, 2004 8:27 pm

$_GET problem

Post by sk8erh4x0r »

I'm trying to get a value that has a + sign in it, but it seems to take out the + when i use $_GET['id'];

ex: id=c++
$_GET['id'] = c

Is there anyway around this?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

requires urlencoding... use rawurlencode() in php or escape() in javascript.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

sk8erh4x0r
Forum Commoner
Posts: 43
Joined: Wed May 26, 2004 8:27 pm

Post by sk8erh4x0r »

rawurlencode() didn't work. I tried urlencode() and it partly worked because it kept the ++, but it changed the / into %2F

c%2Fc++

Is there a way to have it ignore certain characters?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

you have to decode it when you want your original value.. urldecode()
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you never specified it was a URL you needed to "fix" .. regular expressions are good for this.. explode() can work too, or rather, parsing the string for parts then processing the parts as needed is the real way to go.
Post Reply