Forum Moderators: coopster

Message Too Old, No Replies

Quotes around HTML attributes

         

Fenrir

10:12 am on Feb 7, 2007 (gmt 0)

10+ Year Member



If I am using echo to return some HTML how do I get quotes around the attributes? In ASP I would use a double quote i.e.

response.write ("<h1 align=""center"")

to give

<h1 align="center">

but this doesn't work in PHP, I'm hoping someone can enlighten me!

--
Jan

cameraman

10:19 am on Feb 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're using double-quotes, you escape them:
echo "<h1 class=\"big\">";

You can also use single quotes in an echo:
echo '<h1 class="big">';

[us2.php.net ]
explains the differences in detail.

Fenrir

7:12 pm on Feb 9, 2007 (gmt 0)

10+ Year Member



Great, thank you very much Cameraman!