Latest Entries »

Tuesday, September 29, 2009

sample code for undestand php file handling functions

$comment = $_POST["txtcomment"];
if ($comment!=""){
$date=date('l dS \of F Y h:i:s A');
$massage = $date.": ".$comment."\n";

$file=fopen("comment.txt","a+") or exit("Unable to open file!");
fwrite($file,$massage) or die("Could not write to file");
fclose($file);
echo "Massage sent!";
}

?>

This will write the massage to the comment.txt file.

0 comments: