I did searches all over this site, and a few other php sites... and I am trying to find a way to take a string (mostly pulled from a database in a while loop), and using it in a value inside javascript.
Ex:
inside some javascript html:
var fb_Titles = new Array(<?PHP while ($row = $db->row($query)){ $c++; echo "'$row[0]'"; if ($c != $numrows) echo ", "; }?>);
Now, inside the database, the cell could contain titles with spaces, or slashes, or even ascii characters like tiny TM or circle R etc... pretty much ANYTHING.
The question I have been banging my head against the wall on, is how do I escape all that so javascript doesn't freak out on the client browser when it gets invalid chars in there???
We got an "addslashes();" function, and we have "urlencode();" ... but I am not finding "javascriptencode();" (or something of the like).
Anyone got any bright ideas? besides making the largest find and replace function the world has ever seen for every character known to make that needs to be converted to whatever javascript likes it to be?