Script error

Javascript coding ..

Moderators: egami, macek, gesf

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

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

onclick=check($row['desc']);

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

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

Tue Aug 17, 2010 4:03 am

You need to put quotes like this:

Code: Select all

onclick=check("$row['desc']");
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 ?>. http://www.php.net/manual/en/ini.core.php

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests