Forum Moderators: coopster

Message Too Old, No Replies

PHP writing quotation marks to txt file

how do I stop it writing a forward slash as well

         

al1911

7:15 pm on Jun 12, 2005 (gmt 0)

10+ Year Member



i'm trying to get PHP to write a little bit of code into a text file. I have no problem writing to file (with fwrite), but when I type a quotation mark into the input field containing the text to be written, PHP write the quotation mark preceeded by a forward slash.

eg. " is written into the file as \"

this is disastrous because the text file must be used for content for an html page obviously containing html tags with attributes.

can anyone suggest any ways of solving this?

dreamcatcher

7:33 pm on Jun 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try using stripslashes when you write the data:

$fp = fopen(...
fwrite($fp, stripslashes($data));

[uk2.php.net...]