In my previous message, I asked how to get rid of the \" and \' when I wrote to a file from a form using a <textarea> ... People told me to use stripslashes(string)... however, i tried and tried but it wont work. I'm trying to open the file, load all of its contents into a temp variable, "stripslash" that temp variable, then load the contents in the temp into the same data file (of course erasing the old)... everytime I write data to the page... this is my write function... please HELP! :
WRITE FUNCTION:
{
$TheFile = "./data/news.txt"; // Points to news file
$Open = fopen($TheFile,"a"); // Opens the file and is ready to write to the end of the file
str_replace("\\"","\"",$Open);
$datepattern = "[0-9]+.";
if(($Open) && (eregi($datepattern, $date))) // If the file is open, then...
{
fwrite($Open, "\n$newsEntry\n$date\n"); // Write the date and news entry to the file
fclose($Open);
print("Write news fucntion completed sucessfully!<tt> <br>Inputs: <br><br> Date: $date <br> Entry: $newsEntry</tt> <br><br><a href='../index.php'>Return to index.php</a>");
}
else
{
// If failure, print debugging info...
print("[DEBUGGING NEEDED]<br><br>");
if(eregi($datepattern, $date))
{
print("The date input ( $date ) must begin and end with a digit.");
}
if($Open)
{
print("File '\"Open\" = $Open <br> File \"TheFile\" = $TheFile <br><br>");
}
print("Write News function failed!<br><tt> Inputs: <br><br> Date: $date <br> Entry: $newsEntry</tt><br><br><a href='../index.php'>Return to index.php</a>");
print("<br>[END DEBUGGING]<br>");
}
} // End Write News
END PHP CODE
Thanks