apostrophe problem in my form field

Discussion in 'PHP' started by adsegzy, Oct 14, 2010.

  1. #1
    am having problem with my apostrophe sign (') in my form field. whenever an apostrophe is inserted in my form (eg can't, don't etc) it will be sent or echoed or store in my database as can/'t or don/'t. what can i do to make it appear the normal way?

    regards,
     
    adsegzy, Oct 14, 2010 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Always use addslashes function of php before putting data into mysql. That is the way to ensure that texts are entered correct and retrieved correct. Moreover it resolves a security issue as well.
     
    mastermunj, Oct 14, 2010 IP
  3. lukeg32

    lukeg32 Peon

    Messages:
    645
    Likes Received:
    19
    Best Answers:
    1
    Trophy Points:
    0
    #3
    You should not use the addslashes function if you are sending it to mysql; you should use mysql_real_escape_string; quotes are not the only thing that can break a query.
     
    lukeg32, Oct 14, 2010 IP
  4. betaturn

    betaturn Peon

    Messages:
    273
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Use stripslashes function before writing that variable to database.

    $value=stripslashes($value);
     
    betaturn, Oct 17, 2010 IP