Help with Strings

Discussion in 'PHP' started by weknowtheworld, Nov 21, 2006.

  1. #1
    I need help in the following...

    I have a variable in a form ...
    say $abcd = "MacDonald's Burger";
    and a textbox stores this data.
    Now when I send this variable again to the same form the string becomes...
    "MacDonald\\'s Burger";

    Why??
    And how can I remove the forward slashes from the variable...
    Using preg or something...

    Can someone write me the code, Please?
     
    weknowtheworld, Nov 21, 2006 IP
  2. PinotNoir

    PinotNoir Peon

    Messages:
    505
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #2
    use stripslashes, a single quote is just as a good as a double quote. it probably thinks the apostrophe is a single quote. dont know the code. someone will come along in a minute and give it to you im sure.
     
    PinotNoir, Nov 21, 2006 IP
  3. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yes, stripslashes will do it

    ex:
    $oldString = "MacDonald's Burger";
    $newString = stripslashes($oldString);
     
    lbalance, Nov 21, 2006 IP