Script error

Javascript coding ..

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am

Thu Jan 08, 2009 7:37 am

i try to pass php value which is $row['desc'], to javascript. and this error appear, 'unterminated string constant', if the data dont have space like 'test', then no error appear, if the data like 'test test', then the error will appear. any solution for this, the code is like this


what are the different between <?php ?> and <? ?> ?

New php-forum User
New php-forum User
Posts: 92
Joined: Tue Aug 17, 2010 2:00 am
Location: Ukraine Kharkov

Tue Aug 17, 2010 4:03 am

You need to put quotes like this:

Code: Select all

About different between <?php ?> and <? ?> - You can use both variants but second will work only on those servers where the short_open_tag flag set to 1. Not all of them allow this so best practice is to use <?php ?>.

Post Reply