Form Problem

Discussion in 'HTML & Website Design' started by bloard, May 17, 2006.

  1. #1
    I have a text form field on one page, that posts the input to another page. So if the form is on page1.php, and lets say the form is like this: <form method="post" action="page2.php">

    Now, the field I am talking about is a text field, so lets say it looks like this:
    <input type="text" name="variablename" id="textfield" />

    The problem is, that I want to input a single quote (") in the form field. But when I view the output on the page receiving the results (page2.php) the quote is escaped by a preceding slash (\) so the posted data is \" .

    How do I change something so that is is just passing the quote?

    Thanks
     
    bloard, May 17, 2006 IP
  2. marty

    marty Peon

    Messages:
    154
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello bloard I've run accross this issue many times and the only solution I've ever seen is to replace " with &quot; so before you write out the value in you PHP you could replace all " characters with &quot;

    Good luck :)
     
    marty, May 17, 2006 IP
  3. naturaldesigns

    naturaldesigns Member

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    I think you have to search for a solution in the php section...you have to parse some way I think..
     
    naturaldesigns, May 17, 2006 IP
  4. TechnoGeek

    TechnoGeek Peon

    Messages:
    258
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hello, bloard.
    I think you should revise your PHP configuration. There is an option called "magic_quotes" that sets the magic_quotes state for Get/Post/Cookie operations. When magic_quotes are on, all ' (single-quote), " (double quote), \ (backslash) and NUL's are escaped with a backslash automatically. I understand that this can be modified at run time, but you should ask for more information at the PHP forum.
    Good luck.
     
    TechnoGeek, May 20, 2006 IP