I am having some problems with my insert.
I have this code below, and when I click on submit button to subscribe I don't get any error, but I don't receive the insert on my database.
It's a strange situation, because everything seems correct:
-> I don't have any error message
-> if I do echo echo $email;
and echo $code;
the variables have the right value
-> the name of the table is correct
Can you see something here that can be giving this issue?
My Php:
<?php
if(isset($_POST['newsletter_subscription']) && $_POST['newsletter_subscription'] == 'register')
{
$email = $_POST['email'];
$code = md5($email);
try
{
$subscription = $pdo->prepare("INSERT into subscriptions (email,code,status) VALUES = :email,:code,:status");
$subscription->bindValue(":email", $email);
$subscription->bindValue(":code", $code);
$subscription->bindValue(":status", 'inactive');
$subscription->execute();
}
catch(PDOException $e)
{
$e->getmessage();
}
}
?>
My Html form:
<form action="" name="newsletter" method="post" enctype="multipart/form-data">
<label>
<input type="text"id="email2" name="email" placeholder=" e-mail" required/>
</label>
<br />
<label id="submit">
<input type="hidden" name="newsletter_subscription" value="register" />
<input type="submit" name="register" value="Register" src="" />
</label>
</form>