SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The < in a record

    Hey guys,

    Whenever I use a < character on a string field it will convert it to &lt; and &gt; for the greater than sign.

    Is there a way I can prevent this from happening?

  2. #2
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I am assuming you are using php with the database. It may be using htmlspecialchars on the field in the code before adding to your database. This will save you headaches later. If you really want <,> to appear check your code to see if that function is used.
    Ryan B | My Blog | Twitter

  3. #3
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I am. And thanks for the suggestion Ryan B.

    I think it was the textarea that was replacing the characters, but not exactly sure. What I ended up doing, if you're curious, is replaced the < > with unique character strings and converted them back with a javascript variable. I'm using javascript to display table records along with an editing form - I'm not going out of my way to use js for this.

    Anyway, thanks again, and have a good one.

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)


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
  •