Reputation: 29
echo "<a href="http://www.quackit.com/common/link_builder.cfm" onclick="basicPopup(this.href);return false">Open a popup window</a>";
I am new to PHP. I am currently having the following error:
Parse error: syntax error, unexpected 'http' (T_STRING), expecting ',' or ';' in search.php on line 91
I know its a syntax error, but I have tried many times, and still can't solve the problem.
Upvotes: 0
Views: 10918
Reputation: 886
try this code
<?php
echo "<a href='http://www.quackit.com/common/link_builder.cfm' onclick='basicPopup(this.href);return false'>Open a popup window</a>";
?>
Upvotes: 0
Reputation: 20199
Escape the quote or use single quote solved the problem.
Try
Escape the double quote within the quote
<?php
echo "<a href=\"http://www.quackit.com/common/link_builder.cfm\" onclick=\"basicPopup(this.href);return false\">Open a popup window</a>";
?>
or
Use single quote
<?php
echo "<a href='http://www.quackit.com/common/link_builder.cfm\' onclick='basicPopup(this.href);return false'>Open a popup window</a>";
?>
Upvotes: 0
Reputation: 2992
Your problem is the quotes, however you don't need to echo it at all. If you need to echo variables inside the url, try this:
<a href="http://www.quackit.com/common/link_builder.cfm?<?php echo $variable;?>" onclick="basicPopup(this.href);return false">Open a popup window</a>
alternatively, you can escape the quotes inside the string using a backslash:
echo "<a href=\"http://www.quackit.com/common/link_builder.cfm\" onclick=\"basicPopup(this.href);return false\">Open a popup window</a>";
Upvotes: 1