SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem PHP variables containing HTML with apostrophes

    I'm new to PHP so I'm not too sure about this one. I am keeping HTML in a PHP variable named $content so let's says content contains...

    Code:
    $content = '<p class="p_style">You\'re right!</p>';
    I'm using "\" to make sure it doesn't grab the apostrophe. Now when I output $content it makes the "\" literal so is there another way to make sure apostrophes don't register in PHP, but output correctly in HTML?

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2001
    Location
    California
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was able to print out that statement just fine. Are you doing something else to the var $content?
    We're all here because we're not all there.

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2007
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, nevermind. I just tried it and it looks like I was missing something else in the rest of my code that was corrupting the output. Thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •