php adding slash to file.

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

    php adding slash to file.

    Hello

    I've been trying to figure this problem out for quite a while and I'm
    having no joy.
    I'll give you some background info, I'm creating a form and one of the
    fields in the form is a big text area that I want to use to write to
    a text file. This works fine but the problem is all the single quotes
    are get escaped with slashes.

    I want to write to the text file with out the quotes getting escaped,
    I've tried htmlentities but that doesn't seem to work.
    Here is a snippet of the code.

    $Desc_file = date("dmYHis");
    $Desc_new = htmlentities($d esc, ENT_QUOTES);
    $filePath = "/public_html/nsite/info";
    $WriteToFile = fopen("$filePat h/$Desc_file","w+ ");
    fwrite ($WriteToFile, $Desc_new);
    fclose ($WriteToFile);

    Any ideas would be fantastic Thanks in advance for your help

    Mudassar
  • Jon Kraft

    #2
    Re: php adding slash to file.

    mudassar@aircan dy.co.uk (mudassar) wrote:
    [color=blue]
    > I've been trying to figure this problem out for quite a while and I'm
    > having no joy.
    > I'll give you some background info, I'm creating a form and one of the
    > fields in the form is a big text area that I want to use to write to
    > a text file. This works fine but the problem is all the single quotes
    > are get escaped with slashes.
    >
    > I want to write to the text file with out the quotes getting escaped,
    > I've tried htmlentities but that doesn't seem to work.
    > Here is a snippet of the code.
    >
    > $Desc_file = date("dmYHis");
    > $Desc_new = htmlentities($d esc, ENT_QUOTES);
    > $filePath = "/public_html/nsite/info";
    > $WriteToFile = fopen("$filePat h/$Desc_file","w+ ");
    > fwrite ($WriteToFile, $Desc_new);
    > fclose ($WriteToFile);[/color]

    stripslashes()


    HTH;
    JOn

    Comment

    • Alvaro G Vicario

      #3
      Re: php adding slash to file.

      *** mudassar wrote/escribió (9 Dec 2003 04:10:18 -0800):[color=blue]
      > I'll give you some background info, I'm creating a form and one of the
      > fields in the form is a big text area that I want to use to write to
      > a text file. This works fine but the problem is all the single quotes
      > are get escaped with slashes.[/color]

      That's a very peculiar PHP feature that seems to be set to on in your
      server. It's called "magic quotes". You can either turn it off in php.ini
      or use stripslashes().

      Also check get_magic_quote s_gpc() to make portable code.

      --
      --
      -- Álvaro G. Vicario - Burgos, Spain
      --

      Comment

      Working...