I have something like this
Any idea how can I get this to work?
$var1 = "hello world " hello world"; // var1 get the value from sql. this is just some make up data.
<a href="#" onclick="test('$var1')">click me</a> // the problem i have is here.
I want it to be test( "hello world " hello world") but it turned out to be test( "hello world " hello world").
Last edited by byebyebyezzz; 03-20-2012 at 12:12 PM.
You could always use replace to insert a \ before the "
I tried /" before but I never tried /". I ll give it a try tomorrow.
No, that slash is the wrong direction. Try the one that should be above the enter/return key on your keyboard... it goes from upper-left to lower-right...
Originally Posted by byebyebyezzz
Use single quotes:
Php interprets anything between double quotes, but not between single quotes. Php will interpret between single quotes in heredocs.
$var='x and y " plus 2'
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)