Forum Moderators: coopster

Message Too Old, No Replies

Stipping out '+' sign

         

PeteM

6:08 pm on Oct 4, 2005 (gmt 0)

10+ Year Member



I'm passing a variable to my sctipt and the variable contains a plus sign e.g.?var=james+bond. However when I attempt to use the variable by coding $HTTP_GET_VARS[var] the plus sign is gone.

Any ideas?

JerryOdom

8:54 pm on Oct 4, 2005 (gmt 0)

10+ Year Member



php probably replaces the plus signs because they're a historically standard replacement for spaces. I'm too lazy to test the theory but I'm pretty sure its something like that due to encoding/decoding for processing.

urlencode documentation talks a little about it

[us3.php.net...]

PeteM

6:30 am on Oct 5, 2005 (gmt 0)

10+ Year Member



Thanks. Is the solution then just to do a str_replace and replace the ' ' with '+'? Or is there a more elegant way?

bulkit

10:01 am on Oct 5, 2005 (gmt 0)

10+ Year Member



just pass it back through urlencode - urlencode($HTTP_GET_VARS[var]);