PDA
Partners

View Full Version : duble quotes from php into javascript


airnine
January 11th, 2004, 06:26 PM
Hi guys,

I use php and javascript 99% of the time and have a question that's really been bugging me for a while. I have solved it now, but would still like to know how other people deal with this type of things. In both php and javascript one can choose to use either single quotes or double quotes, but what do you do when you pull a message from mysql table that contains double quotes and put it in a php generated javascript alert message? Do you replace " with \" or go for char(34) or some third thing?

Airnine

Steveo31
February 8th, 2004, 06:23 PM
I have seen \" used most often. I do that in Flash A.S. as well.

Matrix28
February 20th, 2004, 01:15 PM
Yeah, as steveo said. Go for the \" option;

kitty
August 31st, 2005, 08:14 AM
yes u have to use \" or single quate '