Sorry Thorpe, I did not word that correctly.
What I meant by "it shows a valid email address" was that it shows the address I entered into my form, not an email address that exists in the table.
I used similar code for another email signup page...
$query = 'SELECT * FROM eletter WHERE EmailAddress="'.$EmailAddress.'"';
$result = mysql_query($query) or die(mysql_error());
if(!$result){
$query_insert = "insert into eletter EmailAddress, Date, Time, Confirmed values('$EmailAddress','$Date','$Time', '$Confirmed')";
$insert = mysql_query($query_insert, $conn) or die(mysql_error());
$var = "Thank you for signing up<br>for our e-Newsletter.";
}
else {
$query_update = "update eletter set EmailAddress='$EmailAddress', Date='$Date' , Time='$Time', Confirmed='$Confirmed' WHERE `EmailAddress` = '$EmailAddress'";
$update = mysql_query($query_update,$conn) or die(mysql_error());
$var = "Thank you for updating<br>your email address.";
}
And that worked as I planned (inserting the email address if it did not exist in the database, or , update the email address if it did exist).
So I just modified it to my first post, and I expected it to check the db for the email address and ...
A) insert the address if it did not exist and thank you.
or
😎 check and see the address already exists and tell you that you already signed up.
What I am getting is it checks the db and does not find the address and then tells you you already signed up.
Thats my confusion.
Does that make more sense?
Thanks again,
Don