robingo Posted April 23, 2010 Share Posted April 23, 2010 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 More sharing options...
ChemicalBliss Posted April 23, 2010 Share Posted April 23, 2010 I believe it's to do with how php santizes strings in the POST array. use stripslashes($_POST[úpdate']); -cb- Link to comment https://forums.phpfreaks.com/topic/199529-removing-the-backslashes/#findComment-1047277 Share on other sites More sharing options...
robingo Posted April 24, 2010 Author Share Posted April 24, 2010 Works great! Thanks a lot! Link to comment https://forums.phpfreaks.com/topic/199529-removing-the-backslashes/#findComment-1047533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.