Jump to content

Removing the backslashes


robingo

Recommended Posts

Hi,

I'm writing a php script that allows you to update a .txt-file.

Here's what I have:

<?
if($_POST['Submit']){
$open = fopen("wat.txt","w+");
$text = $_POST['update'];
fwrite($open, $text);
fclose($open);
echo "File updated.<br />"; 
echo "File:<br />";
$file = file("wat.txt");
foreach($file as $text) {
echo $text."<br />";
}
}else{
$file = file("wat.txt");
echo "<form action=\"".$PHP_SELF."\" method=\"post\">";
echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">";
foreach($file as $text) {
echo $text;
} 
echo "</textarea>";
echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n
</form>";
}

?>

 

It works fine, but there is a problem.

In the .txt file, there is something like:

<font color="#EA323F" size="35">blablabla</font>

 

When I update the .txt-file with my script, my script automaticly turns this into:

<font color=\"#EA323F\" size=\"35\">blablabla</font>

 

I use this .txt-file as external text in a flash-movie, and, I get an error when my flash-movies loades the converted .txt-file (with the backslashes).

So, I need a script like this, but it has to update the .txt-file without placing the backslashes...

 

Anyone knows how to do this?

Thanks in advance!

 

Link to comment
https://forums.phpfreaks.com/topic/199529-removing-the-backslashes/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.