Hey All,
I've got a web page that displays multiple boxes of text using php. The text are coming from .txt files instead of using a database to store the data. I can update these text files when I want to change the information.
My problem is that I need stripslashes to be put in because I'm getting (don\'t) instead of (don't), and I can't figure out where to put the stripslashes function to make it work. This only happens when I use my update form. If I alter the .txt document manually, no problem, so my problem must lie in my update.php file.
Here is my Update.php file so you can see what I've done.
<?php
if($_POST['Submit']){
$open = fopen("b12.txt","w+");
$text = $_POST['update'];
fwrite($open, $text);
fclose($open);
echo "File updated.<br />";
echo "File:<br />";
$file = file("b12.txt");
foreach($file as $text) {
echo $text."<br />";
}
echo "<p><a href=\"./index_update.php\">click here to return to main page</a></p>";
}else{
$file = file("b12.txt");
echo "<form action=\"".$PHP_SELF."\" method=\"post\">";
echo "<textarea Name=\"update\" cols=\"50\" rows=\"20\">";
foreach($file as $text) {
echo $text;
}
echo "</textarea>";
echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n
</form>";
}
?>
if anyone can point me in the right direction it would be great. I'm still new to this but learning all the time.
Thanks.