Parse Error: Syntax Error, Unexpected '' (t_encapsed_and_whitespace), Expecting Identifier (t_string) Or Variable
I keep getting this error when I do this:
Solution 1:
You do not need to write this line
jsvar = <?phpecho$row['name'], $row['year'], $row['genre'];?>
just use
jsvar = {$row['name']} {$row['year']} {$row['genre']};
because you are already in PHP.
Also
Replace
myWindow.document.write('<inputtype="button"value="Buy"onclick=/"buy()/">');
with
myWindow.document.write('<input type=\"button\" value=\"Buy\" onclick=\"buy()\">');
Solution 2:
$row = mysql_fetch_array( $result );
// Print out the contents of each row into a table //echo $row['name']." ".$row['year']." ".$row['genre'];?>
<script language=javascript>
var jsvar;
jsvar = <?phpecho json_encode($row['name']), json_encode($row['year']), json_encode($row['genre']);?>functionbuy() {
window.location = \"https://www.paypal.com\";
alert(\"Thanks for shopping at Movie Store\");
}
...
</script>
Post a Comment for "Parse Error: Syntax Error, Unexpected '' (t_encapsed_and_whitespace), Expecting Identifier (t_string) Or Variable"