PDA

View Full Version : HTML in Echos



MrCraig
25-04-2007, 03:20 PM
Right, does anyone know how to put html coding inside a php echo?

Im sure you can do it somehow but whenever i try, i get a parse error :(

Heres what im doing if you can help solve the problem

<? echo("<img src="$logged[badge].gif">");?>

Thanks for any help :]

Edited by L&#181;ke (Forum Moderator): Thread Moved from Website Designing. Please post in the correct section next time, Thanks :).

Luckyrare
25-04-2007, 03:21 PM
<?php
echo("<img src=\"$logged[badge].gif\">");
?>

Add back slashes before "

MrCraig
25-04-2007, 03:24 PM
Thanks Danny :) +rep

Blob
25-04-2007, 03:28 PM
Or use


<?php echo 'Hello <a href="link.htm">Hi</a>';

but if you use a ' in the echo, you have to put


<?php echo 'Hello <a href=\'link.htm\'>Hi</a>';

MrCraig
25-04-2007, 03:57 PM
Thanks Dunko :] +rep

Blob
25-04-2007, 04:45 PM
btw, If you are going to use any of my script up there make sure you add ?> at the end ty

Florx
26-04-2007, 03:57 PM
BUT if you plan on echoing variables you need to use


echo "<a href=\"page.php?id=$id\">Link</a>";

Want to hide these adverts? Register an account for free!