this should get you off and running. try this first.
go visit this link and enter a fictitious email if u can.
then blah blah, just , i dunno play around heh. is that what you wanna do ?
its on my server i was playing around trying to achieve what you wanted...only problem is it fails to catch out emails entered that already EXIST in the file haha.
i know i can sort that out, but why dont YOU sort it out for a change ?

heres the code I used dude
==========================================================
// call this page 'add_fields'
// and save it as a htm page.
<html>
<head>
<title>add emails</title></title>
</head>
<body>
<form name='myform' method="post" action="checkemails.php">
<br>
Enter email address <input type="text" name='new_email' value="">
click to add email <input type="submit" name="submit" value="Add Email">
</form>
</body>
</html>
============================================================
// and call this script checkemails.php
// just copy n past ethe code into a notepad document
// go to save as, next to where it saves filename, add
// .php
// now next to where it says save as type pick 'all files'
// and save.
<?
$new_email = $_POST['new_email'];
// posted email stored in variable called new_email
// it came from your form
$filename = "emails.txt";
$fileptr = fopen($filename,"r"); // open for read
$myarray = file($filename);
// for ($i = 0; $i<count($myarray); $i++)
// {
$oneEmail = $myarray[$i];
// get one email address, one line from the text file
// at a time
if (strcasecmp($new_email,$oneEmail) == 0)
{
print "This email already exists!" ."<br>";
print "Please enter a different email" . "<br>";
fclose($fileptr);
// maybe add some code here to 'redirect to form'
}
else
{
$fileptr = fopen($filename,"a");
// write new email into text file after inserting
// a new line
fwrite($fileptr, "\n$new_email");
// use \r and \n in double quotes to add a cariage return and new line
print "you have added $new_email to the emails list" ."<br>";
fclose($fileptr);
// and you use the file pointer variable and the variable holding your new email with fwrite, to write
// to ya text file
$fileptr = fopen($filename,"r");
// now lets do a read , of the file and read our email list
$fileptr = fopen($filename,"r");
$myarray = file($filename);
foreach ($myarray as $newline)
{
print $newline . "<br>";
}
// but lets look at it as an array
fclose($fileptr);
}
// fclose($fileptr);
print " click the button below to view your text file";
print"<br>";
?>
<html>
<head>
<body>
<form name="myform2" method="post" action="emails.txt">
<input type="submit" name="submit" value="View emails.txt file!">
</form>
</body>
</head>
</html>
============================================================
and create a made up text file, i made one up and it appears on browser when you use the program i wrote.
if you want any more help let me know.
kindest regards
lazy c0der