lszanto Posted May 10, 2007 Share Posted May 10, 2007 I've been using fwrite a fair bit to edit a stylesheet but for some reason everytime I put in a single quotation like ' or normal quotation marks like " it comments them out when I open the file stuffing everything up e.g " will become \" does anybody know how to fix this? Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/ Share on other sites More sharing options...
pocobueno1388 Posted May 10, 2007 Share Posted May 10, 2007 Could you post the code? Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/#findComment-249671 Share on other sites More sharing options...
MadTechie Posted May 10, 2007 Share Posted May 10, 2007 i don't think thats fwrite, review other parts of your code Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/#findComment-249673 Share on other sites More sharing options...
igor berger Posted May 10, 2007 Share Posted May 10, 2007 You may want to look at these two functions. stripslashes () addslashes () Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/#findComment-249675 Share on other sites More sharing options...
lszanto Posted May 10, 2007 Author Share Posted May 10, 2007 Ok here is my code. //Get vars. $style = $_POST['style']; //Open file for writing. $fh = fopen($path . "text.css", "w"); //Write data. $write = fwrite($fh, $style); //Check if works. if($write) { //Close file. fclose($fh); //Echo results. echo "<p>\n\nYour styles have been updated, please click <a href=\"view_news.php\" target=\"_blank\" >here</a> to see the changes."; } I'll check the stripslashes() function now. Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/#findComment-249679 Share on other sites More sharing options...
MadTechie Posted May 10, 2007 Share Posted May 10, 2007 use stripslashes() after the $_POST Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/#findComment-249684 Share on other sites More sharing options...
igor berger Posted May 10, 2007 Share Posted May 10, 2007 Hey Mad, I do all the work, and you get credit for it. Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/#findComment-249685 Share on other sites More sharing options...
MadTechie Posted May 10, 2007 Share Posted May 10, 2007 lol, hardly a lot of work Sends a credit note to igor berger Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/#findComment-249700 Share on other sites More sharing options...
igor berger Posted May 10, 2007 Share Posted May 10, 2007 Thanx for the credit, but just joking. As far as hard work, if you need a certain function and you do not know about it, you might as well bang your head against the wall. It took me a few years before I found it by accident. That why we get paid big bucks for little work. That is when we on the clock, not here. Link to comment https://forums.phpfreaks.com/topic/50777-solved-fwrite-quotation-marks-escaping/#findComment-249701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.