Forum Moderators: coopster

Message Too Old, No Replies

unexpected T STRING, expecting ',' or ';'

         

markrw58

10:04 pm on Sep 24, 2007 (gmt 0)

10+ Year Member



Seems like this is a pretty common mistake but I have looked through a number of other solutions and cannot get anything work like I want it to.

Here is the is the code:

<?php
if(isset($_COOKIE[userkey])) {

echo '<a href="http://www.example.com/listing_1a.php?id='.$id.'">View More Pictures</a>' ;

}else{

echo '<a href="welcome.html" onclick="return popitup('welcome.html')">View More Pictures</a>';
}
?>

The error occurs on the second "echo", if I remove all of the " & ' the error goes away but clickling on the link does not open the webpage in a pop-up window, it opens it in the same window.

Mark

[edited by: eelixduppy at 10:16 pm (utc) on Sep. 24, 2007]
[edit reason] use example.com for exemplification [/edit]

jatar_k

10:10 pm on Sep 24, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld markrw58,

quick edit ;)

you just have mismatched quotes in the echo in the else

try this
}else{
echo '<a href="welcome.html" onclick="return popitup(\'welcome.html\')">View More Pictures</a>';
}

you need to escape the single quotes inside the echo since you enclosed the line in single quotes

markrw58

10:28 pm on Sep 24, 2007 (gmt 0)

10+ Year Member



Thank you Jatar_K

That did it!

Mark