Ok so using a bit of what you pasted here, this what I have:
//Post the email address
$strEmailAddress = $_POST["email"];
$myFile = "registration.txt";
if (!file_exists($myFile)) {
die('the data file was not found');
}
$fh = fopen($myFile, 'r')
or die('could not open ' . $myFile);
$theData = fread($fh, filesize($myFile));
if(!$theData) {
die('no data was returned from ' . $myFile);
}
//just testing to see if the file is being read
echo $theData;
if(stristr($theData, 'lookforthisaddress@aol.com') === TRUE) {
echo 'I found your address in registration.txt';
}else {
echo 'I did not find your address in registration.txt';
}
Note I echoed the contents of $theData just to be sure the file is being read. I get the email addresses printing out one after another with a space in between them(email1 email2 email3). The way they are written to the text file is as such:
//Write the email address to a text file for later checking
$myFile = "registration.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$break = "\n";
fwrite($fh, $strEmailAddress);
fwrite($fh, $break);
fclose($fh);
die();
Not sure that's necessary to show, but that's how i'm doing it. This produces a text file with one address per line.
The function stristr should be looking in the variable $theData for the email address "lookforthisaddress@aol.com". I don't think it's doing that. Also, that wouldn't help the situation. I would need the appropriate synatax to dump the value of $_POST["email"] between those quotes as a string because that's the email address that it's checking against the list keeps changing based on user input.
I really appreciate the help 🙂
Regards,
Matt