Im doing a newsletter system, where a user enter his mail inside my input text and click on submit to subscribe in newsletter.
After he click on submit, he will receive an email, saying to confirm his subscription he needs to click in a link that I make available in this email.
This is the link:
<p>To confirm your subscription click on link below:</p>
<a href="http://localhost/website/newsletter/confirm?email='.$email.'&code='.$code.'">Confirm Subscription</a>
And this link will redirect to my newsletter confirmation page where I Will get email and code and then I will do an update on my subscribers table.
$email = $_GET['email'];
$code= $_GET['code'];
$pdo = start();
$updSub = $pdo->prepare("UPDATE subscribers set status= ? WHERE code = ?");
$updSub->bindParam(2,$code);
$updSub->execute();
But Im having this two notices:
Notice: Undefined index: email in F:\Xampp\htdocs\website\newsletter\confirm.php
Notice: Undefined index: code in F:\Xampp\htdocs\website\newsletter\confirm.php
Do you see why this can be happening? Im using a .htaccess file, dont know if it may be because of that, some problem with passing variables code and email in url.
This is my htaccess file:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1
My query string:
@$url = $_GET['url'];
$url = explode('/', $url);
$url[0] = ($url[0] == NULL ? 'index' : $url[0]);
if(file_exists('template/'.$url[0].'.php')){
require_once('template/'.$url[0].'.php');
}elseif(@file_exists('template/'.$url[0].'/'.$url[1].'.php')){
require_once('template/'.$url[0].'/'.$url[1].'.php');
}
else{
require_once('template/404.php');
}