Forum Moderators: coopster

Message Too Old, No Replies

Won't let me use quotes

         

TGecho

2:09 am on Jun 22, 2003 (gmt 0)

10+ Year Member



I have a script that carries some strings over to the next page. The only problem is, if the strings have any sort of quotes in them (single or double) it causes problems. Double quotes make the url end, and single quotes come out as \'. I tried escaping them but they come out as \\\'. I'm lost, does anyone have any ideas?

grahamstewart

2:14 am on Jun 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could use
htmlentities( $string, ENT_QUOTES );
to encode the string and its quotes.

or you could pass the data as POST rather than GET

jaski

3:24 am on Jun 22, 2003 (gmt 0)

10+ Year Member



Its a safety feature in PHP TGecho.

PHP does that so that if you enter that string in a database the special characters are automatically escaped (to avoid some problems.)

The way around that is .. simply

$mystring = stripslashes($mystring);

HTH
Jaski