Jump to content

[SOLVED] PHP flat file quotes


Grant132

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.