I am new to PHP, so excuse me if I do not use the correct words to describe what I am trying to do. Most of the code for the verification routine came from http://www.bytesworth.com.
I am trying to have a user subscribe to a newsletter. The input form (newsletter_form.php) works fine. It submits all data to the MySQL database, sends an email to the visitor requesting confirmation, and brings the visitor to a page acknowledging their request and telling them they will receive an email they should use to verify their request (newsletter_form_ackn.php). The email they receive has a link ($tbody.="To verify a recent request for this e-mail address to receive the free Josie Prescott Newsletter, please click on http://www.janecleland.net/vemail.php?vmail=" .$email. "."😉.
The code in the page vemail.php is below. When I go to the page (vemail.php) directly, I get the correct error message. But when I click the link in the email I get a Page Not Found error (HTTP 404 - File not found). I have tried placing the code at the very beginning of the page and within the body of the page. It is supposed to change the ACTIVE field from 0 to 1 when the vmail email address is located in the database.
<?php require_once('../../Connections/jkcleland.php'); ?>
//this is from Dreamweaver
<?php
$email=$_GET[vmail];
//This command fetches the "GET" variable from the URL.
$query="update email set active=1 where email='" . $email . "'";
$result=mysql_query($query);
//If the email exists and if its respective active field is 0, then at least one row should be affected.
if(mysql_affected_rows()>0)
{
echo "<p>Congratulations!</p>";
echo "<p>Your email has been verified.</p>";
}
else
//the following error message displays when I go to vemail.php directly, with no variable appending to the URL
{
echo "<p>Sorry! You have either already verified your email, </p>";
echo "<p>or you haven't submitted your details for verification. </p>";
echo "<p> </p>";
echo "<p>Please use the links below to go to the form and submit your details </p>";
echo "<p>or send an e-mail to our subscription department.</p>";
}
?>
And if you need to know: my database name=cleland, table=email, and the fields are email_id, email, name, zip, date, active (the field that needs to change from 0 to 1).
I hope I have some simple stupid syntax mistake. Thank you in advance for any help.