header
 
     
 
pixel
pixel pixel

Using double quotes with variables

When you're outputing variables amongst HTML, if there's a chance there might be an apostrophe ' in your variable, use double quotes in your HTML. For example,
<?php
echo "<img src=\"$filename\">";
?>
Note the escape character \ allowing me to use the double quote. This is particularly important when pulling data from a form or database where you're not certain what might be there.

Unhelpful Helpful Rating 3.1 (score out of 5, no. of ratings: 39)
Comments
Comment by John on 2004-12-03
Another option is: "; ?>

Comment by usman ali on 2011-07-15
thank u very much...

Comment by Latisha on 2012-01-18
You cuoldn't pay me to ignore these posts!

Comment by discount Michael Jordan Shoes on 2010-09-17
Air Jordan Shoes are always so attractive, good quality can ensure the wearer's feet, not only that, the Michael Jordan Shoes has become a fashion, many young people are very fanatical Air Jordan. High price so many people can realize their dreams. Well now, our products directly from third-party products, so we can provide cheap Jordan Basketball Shoes and New Jordan Shoes, high quality, excellent service, come on, give yourself a choice. We offerAir Jordan 1, Air Jordan 2, Air Jordan 3,Air Jordan 4, Air Jordan 5, Air Jordan 6, Air Jordan 7, Air Jordan 8, Air Jordan 9, Air Jordan 10, Air Jordan 11 and so on!

Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image