PHP Help Need :(

Hello, I am a new PHP learner. Is there any way to use HTML ( Especially HTML Hyperlink ) code in PHP echo statement ?

Example -

<?php
echo “visit <a href=“http://www.sitepoint.com/forums/”>SitePoint Forum</a>”;
?>

But this code is not working :frowning:

The problem is that you are using double quotes around the echo statement and also within it, so PHP gets confused about where the statment ends. It sees this as the echo statement:

"visit <a href="

… and then wonders what all the other rubbish is …

You have various options here, such as:


'visit <a href="http://www.sitepoint.com/forums/">SitePoint Forum</a>';
"visit <a href='http://www.sitepoint.com/forums/'>SitePoint Forum</a>";
"visit <a href=\\"http://www.sitepoint.com/forums/\\">SitePoint Forum</a>";

There first one is probably the best.

Many many thanks for your fast reply. It’s working now. Thanks again :smiley: