javascript dies in php

Posted by ti_nhatrang, 01-17-2008, 06:49 AM
Hi guys, I can't seem to put this in a echo statement in php, here's what I got and it doesn't seem to work. Any kind of help would be greatly appreciated. Thanks again in advance.

Posted by foobic, 01-17-2008, 07:45 AM
You have quotes in the javascript you're trying to output. Either escape them (all of them!) or preferably use a heredoc:

Posted by isurus, 01-17-2008, 07:50 AM
Did you check your error log? You are using double quotes within your string - this will be terminating the string prematurely. You could use heredoc syntax: Do you actually need to get php to echo that data? There don't seem to be any PHP variables in there, so why not just close your php tag, output the JS, then open your php tag again:

Posted by isurus, 01-17-2008, 07:53 AM
hmm.. looks like I was too slow to post

Posted by ti_nhatrang, 01-17-2008, 05:50 PM
I've tried both method and it doesn't seem to work, here is the whole section that I'm trying to do:

Posted by ThatScriptGuy, 01-17-2008, 06:27 PM

Posted by ti_nhatrang, 01-17-2008, 06:40 PM
it throws off my alignment if I do what you just recommended.

Posted by ThatScriptGuy, 01-17-2008, 06:44 PM
Then that's your code throwing off your alignment. All I did was separate your PHP conditional from your HTML code.

Posted by ti_nhatrang, 01-17-2008, 06:51 PM
ignore that, it's fine now.

Posted by ti_nhatrang, 01-17-2008, 07:04 PM
Thanks again for all your help! I never thought it could be done this way, which will make things a lot easier from here on out.

Was this answer helpful?

 Print this Article

Also Read

time overlap = total

Posted by ti_nhatrang, 02-07-2011, 10:21 AMHi guys, I got this table with call logs start and...

Changing File ext. to File

Posted by haleyhosting_com, 03-24-2007, 01:31 PMi have a site upithere.com . its a pretty popular...

Forwarding/Default+POP3 Addy Doesnt Work - Piping/Webmail Works

Posted by InfiniteTech, 09-13-2007, 02:06 PMHello, My server which runs cPanel (license issued...

Hosting With support for MS SBS 4.5?

Posted by SimonC, 09-29-2001, 09:26 AMDoes anyone know of a reseller package with support for...

CNAME or A record in DNS Zone?

Posted by olddocks, 01-14-2008, 08:14 AMi have just created a dns ZONE for my domain, but i dont...