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? Quote 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? Quote 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 Quote 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 () Quote 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. Quote 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 Quote 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. Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.