0

I have setup a system whereby a user recieves an email to which they click a button and it will verify their email address. It passes the following url variables to the page:

verify.php?email=testemail@gmail.com&first_name=Test&last_name=User

When the page loads, the information is passed to the database and store, however I have a error message appear afterwards? What am I doing wrong?

PHP Script (verify.php)

<?php
include("admin/dbh.php");

$email = $_GET['email'];
$first_name = $_GET['first_name'];
$last_name = $_GET['last_name'];
$today = date("Y/m/d");
$sql = "SELECT * FROM subscribersList WHERE email=$email LIMIT 1";

$result = $conn->query($sql);
if($result -> num_rows){
    echo "<h1>This email address is already signed up to our mailing list!</h1>";
}else{
    $sql = "INSERT INTO subscribersList (first_name, last_name, email, verified, subDate) VALUES ('$first_name', '$last_name', '$email', 1, '$today')";
    $result = $conn -> query($sql);
    header("location: index.php");
}
?>
DontVoteMeDown
  • 21,122
  • 10
  • 69
  • 105
Matas
  • 186
  • 1
  • 5
  • 18

0 Answers0