Results 1 to 3 of 3

Thread: [resolved] PHP escaping my strings

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2004
    Posts
    121

    Resolved [resolved] PHP escaping my strings

    Hello all, I have a form page which submits to a PHP page. The latter creates a text file, but is escaping my strings for some reason.


    Here is my form page:

    Code:
    <form name="frmMain" action="write.php" method="post">
    <textarea name="txtBody"></textarea>
    <input type="submit">
    </form>
    Here is my processing page:

    Code:
    <?php
    $filename = "output.txt";
    $fp = fopen ($filename,"w") or die("Can't open file.");
    	fwrite ($fp, $txtBody);
    fclose ($fp);
    ?>
    Now when I submit the following text:

    bgcolor="#000000"

    It comes out as:

    bgcolor=\"#000000\"


    Why is PHP escaping my strings? More importantly, how do I stop it?
    Thanks!
    Last edited by solitario; May 27th, 2005 at 02:56 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width