...

View Full Version : writing out Javascript in PHP



jarv
12-12-2010, 04:43 PM
Can someone please tell me what is wrong with this?



echo '<button onclick="gohere("viewpub.php?PubID='.$row['PubID'].'")" id="button" ....

DrDOS
12-12-2010, 04:55 PM
Purely javascript syntax.


echo '<button onclick="gohere("viewpub.php?PubID='.$row['PubID'].'")" id="button" ....

Needs to be;

echo '<button onclick="gohere(\'viewpub.php?PubID='.$row['PubID'].'\');" id="button" ....

so that single quotes enclose what is in parenthesis.

jarv
12-12-2010, 05:17 PM
Excellent! thanks a lot! x



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum