PDA

View Full Version : PHP Script to Save a File via CSV



AndreasMet
26th November 2006, 07:22 PM
I know how to create a variable which has values separated by commas. Then to save it, I echo it to the user and they make the choice whether to open or save it. That works fine when there is a user interaction.

What I need some help on is how to send the same as a file to a user via e-mail.

Any suggestions?

Thanks.

AndreasMet
26th November 2006, 08:17 PM
I know how to create a variable which has values separated by commas. Then to save it, I echo it to the user and they make the choice whether to open or save it. That works fine when there is a user interaction.

What I need some help on is how to send the same as a file to a user via e-mail.

Any suggestions?

Thanks.

OK, so I fugured out how to create a file thanks to PHP web site. The rest is a simple write.

<?php
$myFile = "file.txt";
$fh = fopen($myFile, 'a+') or die("Error!!");
fwrite($fh, "name");
fclose($fh);
echo "I ran."
?>