Simple Question: Writing to file with quotes, etc.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
royce
Forum Newbie
Posts: 9
Joined: Mon Nov 11, 2002 9:57 pm

Simple Question: Writing to file with quotes, etc.

Post by royce »

I'm using this lovely, simple php script to write data to a file line by line. Now that I've used it a while, I ran into a little problem. I need to put quotes in some of my data now. The script writes a nice / to go along with it. Can someone adjust my script so that it likes quotes and these things ----> ' (I forgot what they are called). Thanks! Oh, and I want it to say "Your data has been submitted" on a new page (not an alert) after being submitted.

<?
if($_POST):
$thefile="../dynamic/snowreport.txt";
$handler=fopen($thefile,"w");

foreach($_POST as $k=>$v)
fwrite($handler,"$v\n");

fclose($handler);
endif;
?>
Post Reply