<body><ol>
<li><a href=create5.php>Create 5 records and clear old records</a>
<li><a href=listfile.php>Display data in file</a>
<li><a href=delfile.php>Delete data file</a>
</ol>
<form action=addnew.php method=post>
DATA : <input name=newdata>
<input type=submit value=addnew.php>
</form>
<form action=deldata.php method=post>
ID : <input name=delid>
<input type=submit value=deldata.php>
</form>
<form action=editdata.php method=post>
ID : <input name=idedit>
DATA : <input name=newdata>
<input type=submit value=editdata.php>
</form>
<hr>
<?
$faddr="data.txt";
if (file_exists($faddr)) {
$ar=file($faddr);
echo "Total record in data.txt : ".count($ar);
} else {
$file=fopen($faddr,"w");
fputs($file,"50000,thaiall\n");
echo "No data file. So create file with 1 new record.";
fclose($file);
}
?>
</body>
จำนวน : 32 บรรทัด