<body>
<p>Here is the list before adding the new names.<br>
<?php
$inf = "/tmp/listofnames.txt";
$infw = "/tmp/newlistofnames.txt";
$FILEH = fopen($inf, "r") or die("Can not open File");
$FILEW = fopen($infw, "w") or die("Can not open File");
$inline = fgets($FILEH, 4096);
while (!(feof($FILEH))){
print $inline;
fputs ($FILEW,$inline);
?>
<br>
<?php
$inline = fgets($FILEH, 4096);
}
fclose ($FILEH);
?>
<br>
End of File List </p>
<?php
$name1 = $HTTP_POST_VARS['txtname1'];
$name2 = $HTTP_POST_VARS['txtname2'];
$name3 = $HTTP_POST_VARS['txtname3'];
fputs($FILEW, $name1);
fputs($FILEW, "\n");
fputs($FILEW, $name2);
fputs($FILEW, "\n");
fputs($FILEW, $name3);
fputs($FILEW, "\n");
fclose ($FILEW);
?>
<p>Add to File Complete</p>
<p>Here is the list after adding the new names.</p>
<?php
$FILEH = fopen($infw, "r") or die("Can not open File");
$inline = fgets($FILEH, 4096);
while (!(feof($FILEH))){
print $inline; ?>
<br>
<?php
$inline = fgets($FILEH, 4096);
}
fclose ($FILEH); ?>
End of File List.
</body>
</html>