Page 1 of 1
$_GET problem
Posted: Mon Aug 15, 2005 6:36 pm
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?
Posted: Mon Aug 15, 2005 6:39 pm
by feyd
requires urlencoding... use rawurlencode() in php or escape() in javascript.
Posted: Mon Aug 15, 2005 6:39 pm
by John Cartwright
Posted: Mon Aug 15, 2005 6:54 pm
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?
Posted: Mon Aug 15, 2005 6:59 pm
by John Cartwright
you have to decode it when you want your original value.. urldecode()
Posted: Mon Aug 15, 2005 6:59 pm
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.