Sleeper Posted July 26, 2008 Share Posted July 26, 2008 I have a form where I can input html coding that will be saved to a txt file and then pulled by the website to displate the code entered. I have the form going to a page with the following code. <code> <?php $wfto=$_POST['wfto']; $file_name = "data/wfto-d2.txt"; $fp = fopen($file_name, "w"); //write to the file fwrite ($fp, "$wfto\n"); fclose($fp); ?> </code> My only issue is when it saves the coding all the " end up with \" then when the file is opened up the form text area loads this info and when resaved it will end up like \\\" this obviusly wont work well. So my question is how do I get the post data to write to the text file exactly as entered and not modified so when loaded it looks exactly as it was inputed? Quote Link to comment https://forums.phpfreaks.com/topic/116759-solved-fwrite-question/ Share on other sites More sharing options...
.josh Posted July 26, 2008 Share Posted July 26, 2008 strip_slashes Quote Link to comment https://forums.phpfreaks.com/topic/116759-solved-fwrite-question/#findComment-600462 Share on other sites More sharing options...
DarkWater Posted July 26, 2008 Share Posted July 26, 2008 Actually it's just stripslashes(). No underscore. =P I'd also turn off magic_quotes_gpc() in php.ini. Quote Link to comment https://forums.phpfreaks.com/topic/116759-solved-fwrite-question/#findComment-600468 Share on other sites More sharing options...
.josh Posted July 26, 2008 Share Posted July 26, 2008 Actually it's just stripslashes(). whoops Quote Link to comment https://forums.phpfreaks.com/topic/116759-solved-fwrite-question/#findComment-600473 Share on other sites More sharing options...
Sleeper Posted July 26, 2008 Author Share Posted July 26, 2008 as usual I spent a few hours trying to solve the problum me self and you guys have helped me out again...lol. Thanks alot it works great. Quote Link to comment https://forums.phpfreaks.com/topic/116759-solved-fwrite-question/#findComment-600546 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.