Grant132 Posted February 17, 2007 Share Posted February 17, 2007 Hey, I've been playing around with an update able PHP flat file news program lately. I am able to get it fully running except for one small issue. I have a form page where you enter the details, sends them to a txt file etc. The problem is that if you use " (quotes) in any of the input boxes it will add a \ in front of the quotes when it adds them to the text file. I think i've nailed it down to being: $fh = fopen($data, 'w'); $stringdata = "$time||$date||$new_name||$new_header||$new_news"; fwrite($fh, $stringdata); Correct me if i'm wrong but i think the quotes there are causing it to add a \ to the " so that it ignores it to avoid an error. I've tried using: $fh = fopen($data, 'w'); $stringdata = '$time||$date||$new_name||$new_header||$new_news'; fwrite($fh, $stringdata); However that puts exactly whats there in the text file, i've also tried removing the quotes all together but just got errors. Is there a way to fix this cause its really bugging me? Thanks in advanced for any help you can supply. Grant. Link to comment https://forums.phpfreaks.com/topic/38873-solved-php-flat-file-quotes/ Share on other sites More sharing options...
arifsor Posted February 17, 2007 Share Posted February 17, 2007 $stringdata = str_replace('\"',"",$stringdata); Link to comment https://forums.phpfreaks.com/topic/38873-solved-php-flat-file-quotes/#findComment-186937 Share on other sites More sharing options...
fert Posted February 17, 2007 Share Posted February 17, 2007 http://us3.php.net/manual/en/function.stripslashes.php Link to comment https://forums.phpfreaks.com/topic/38873-solved-php-flat-file-quotes/#findComment-186939 Share on other sites More sharing options...
Grant132 Posted February 17, 2007 Author Share Posted February 17, 2007 Cheers guys, very much appreciated Link to comment https://forums.phpfreaks.com/topic/38873-solved-php-flat-file-quotes/#findComment-186973 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.