text received via POST

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Heinz

    text received via POST

    Hi All


    I am sending a textarea field via POST to a form.

    What happens is that all occurences of ' " and & in the text received via
    $_POST[] in that form are now preceded by a \

    What is causing this and how can I avoid it ?

    I would like to receive the text as seen in the textarea field.

    I am using php 4.2.1

    Thanks in advance
    Heinz



  • Shawn Wilson

    #2
    Re: text received via POST

    Heinz wrote:[color=blue]
    >
    > Hi All
    >
    > I am sending a textarea field via POST to a form.
    >
    > What happens is that all occurences of ' " and & in the text received via
    > $_POST[] in that form are now preceded by a \
    >
    > What is causing this and how can I avoid it ?
    >
    > I would like to receive the text as seen in the textarea field.
    >
    > I am using php 4.2.1
    >
    > Thanks in advance
    > Heinz[/color]

    Try stripslashes().

    Regards,
    Shawn
    --
    Shawn Wilson
    shawn@glassgian t.com

    Comment

    • Kevin Thorpe

      #3
      Re: text received via POST

      Heinz wrote:[color=blue]
      > Hi All
      >
      >
      > I am sending a textarea field via POST to a form.
      >
      > What happens is that all occurences of ' " and & in the text received via
      > $_POST[] in that form are now preceded by a \
      >
      > What is causing this and how can I avoid it ?
      >
      > I would like to receive the text as seen in the textarea field.
      >
      > I am using php 4.2.1
      >
      > Thanks in advance
      > Heinz[/color]

      $plaintext = stripslashes($t ext);

      They're being added automatically by your php settings to protect you
      from SQL insertion attacks.

      Comment

      • Michael Fuhr

        #4
        Re: text received via POST

        Kevin Thorpe <kevin@pricetra k.com> writes:
        [color=blue][color=green]
        > > I am sending a textarea field via POST to a form.
        > >
        > > What happens is that all occurences of ' " and & in the text received via
        > > $_POST[] in that form are now preceded by a \
        > >
        > > What is causing this and how can I avoid it ?
        > >
        > > I would like to receive the text as seen in the textarea field.
        > >
        > > I am using php 4.2.1[/color]
        >
        > $plaintext = stripslashes($t ext);
        >
        > They're being added automatically by your php settings to protect you
        > from SQL insertion attacks.[/color]

        ....specificall y, by the setting of magic_quotes_gp c, which you can check
        by calling get_magic_quote s_gpc(). It's a good idea to make this
        check before calling addslashes() or stripslashes() on form data
        to find out if altering the data is necessary. If you neglect to
        make this check, then the code will probably misbehave if the setting
        of magic_quotes_gp c is ever changed.

        --
        Michael Fuhr

        Comment

        • Heinz

          #5
          Re: text received via POST


          "Heinz" <lullundlall@ya hoo.com> wrote in message
          news:bpfu9b$1nh cig$1@ID-25174.news.uni-berlin.de...[color=blue]
          > Hi All
          >
          >
          > I am sending a textarea field via POST to a form.
          >
          > What happens is that all occurences of ' " and & in the text received via
          > $_POST[] in that form are now preceded by a \
          >
          > What is causing this and how can I avoid it ?
          >
          > I would like to receive the text as seen in the textarea field.
          >
          > I am using php 4.2.1
          >
          > Thanks in advance
          > Heinz
          >
          >
          >[/color]
          Thanks to ALL of you for helping me here.
          I use now :

          if (get_magic_quot es_gpc())
          $text=stripslas hes($text);

          and it works :-)

          Cheers
          Heinz





          Comment

          Working...