escape characters added to form data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • O'Hara

    escape characters added to form data

    Hi,
    Some characters entered in the text fields of a form get an escape
    character. What is the reason? How can I prevent/remove this?

    Here is an example:
    <form action=hello.ph p method=post>
    <input type=text value=firstname >
    </form>

    If the user enters:
    O'Hara

    And I have the following file hello.php:
    <? echo $_POST['firstname']; ?>

    The output is
    O\'Hara



  • O'Hara

    #2
    Re: escape characters added to form data

    O'Hara wrote:
    [color=blue]
    > Hi,
    > Some characters entered in the text fields of a form get an escape
    > character. What is the reason? How can I prevent/remove this?
    >[/color]

    Problem solved.
    I needed to turn off magic_quotes_gp c in /etc/php.ini

    magic_quotes_gp c = Off

    Sorry if this was a VFAQ.
    As for the usefulness of these magic quotes...

    Comment

    • Mazin07

      #3
      Re: escape characters added to form data

      O'Hara wrote:[color=blue]
      > O'Hara wrote:
      >
      >[color=green]
      >>Hi,
      >>Some characters entered in the text fields of a form get an escape
      >>character. What is the reason? How can I prevent/remove this?
      >>[/color]
      >
      >
      > Problem solved.
      > I needed to turn off magic_quotes_gp c in /etc/php.ini
      >
      > magic_quotes_gp c = Off
      >
      > Sorry if this was a VFAQ.
      > As for the usefulness of these magic quotes...
      >[/color]

      In addition, there's a function specifically for slashes:

      StripSlashes( string str )
      AddSlashes( string str )

      Will add/remove the escape slashes

      Comment

      • Geoff Berrow

        #4
        Re: escape characters added to form data

        I noticed that Message-ID: <433476c3$0$234 43$ba620e4c@new s.skynet.be>
        from O'Hara contained the following:
        [color=blue]
        >Problem solved.
        >I needed to turn off magic_quotes_gp c in /etc/php.ini
        >
        >magic_quotes_g pc = Off
        >
        >Sorry if this was a VFAQ.
        >As for the usefulness of these magic quotes...[/color]

        Could be very useful if you find yourself on the wrong end of an
        injection attack...
        --
        Geoff Berrow (put thecat out to email)
        It's only Usenet, no one dies.
        My opinions, not the committee's, mine.
        Simple RFDs http://www.ckdog.co.uk/rfdmaker/

        Comment

        Working...