Parse Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tulsaimagery
Forum Newbie
Posts: 2
Joined: Tue Jul 06, 2010 2:57 pm

Parse Error

Post by tulsaimagery »

I am trying to make a link open up a popup window when clicked and I am getting an error. This was working fine when I just did an href to another page but once I added in this java code to go to a popup window I started getting an error. I do not know enough about it to know what it is I need to fix to make it work. I would appreciate any help.


<?php if($custom_27 != '') { echo '
<div id="listing_offer">'.'<a href="JavaScript:newWindow('/terms_of_service.php','popup',550,450,'')">'.$custom_27.'</a>'.'</div>'; } ?>


Error that I get:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/tuls**/public_html/**/**/***.tpl on line 32
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Parse Error

Post by Jade »

Your echo statement has a comma in it and you need to escape the single quotes in your javascript.

Code: Select all

<?php
if($custom_27 != '') {
   echo '<div id="listing_offer"><a href="JavaScript:newWindow(\'/terms_of_service.php\',\'popup\',550,450,\'\')">$custom_27</a></div>'; 
} 
?>
tulsaimagery
Forum Newbie
Posts: 2
Joined: Tue Jul 06, 2010 2:57 pm

Re: Parse Error

Post by tulsaimagery »

Thanks I got it working
Post Reply