<form name= "Form1" method= "Post" action= ""
<label>
<input type= "text" Name= " Title "
title <br>
<BR>
</label>
<label>
<textarea name= "content" cols= "rows=" ></TEXTAREA>
</label>
Content
<P>
<label>
<input type= "Submit" name= Submit "value="
</label>
</p>
</form>
.
if ( $_post)
{
$file = ' list.txt ';
$array = $_post;
$content = "title:". $array [' title ']. ' contents: '. $array [' content '].CHR (13);
if (file_exists ($file))
{
add_write ($content);
echo ' save Success ';
}
else
{
null_write ($content);
}
}
function null_write ($new)
{
global $file
$f =fopen ($file, "w");
flock ($f, LOCK_EX);
fputs ($f, $new);
fclose ($f);
}
//Add data logging to the end of the file
function add_write ($new) {
global $file;
; $f =fopen ($file, "a");
flock ($f, LOCK_EX);
fputs ($f, $new);
fclose ($f);
}
/*
fopen write files
flock lock files to prevent simultaneous manipulation of
fputs write files. Writes the content to the file
fclose closes the file
notes: This site original reprint indicates the source www.111cn.net
*/
?