I am working on an authentication form, and this is the HTML code:
<input type="text" class="form-control" name="matriculeAgent" placeholder="Compte matriculaire">
<input type="password" class="form-control password" name="motdepasseAgent" placeholder="mot de passe">
This is the PHP code where I compare the matriculeAgent
and motdepasseAgent
with the information of the database:
$matricule_verif = $_POST["matriculeAgent"] ;
//password:
$motdepasse_verif = $_POST["motdepasseAgent"] ;
if ((isset($_POST["matriculeAgent"])==true) && (isset($_POST["motdepasseAgent"])==true)){
$req = $bdd->prepare("SELECT `matriculeAgent`, `motdepasseAgent` FROM `utilisateurs` WHERE `matriculeAgent` ='".$matricule_verif.'"AND `motdepasseAgent` = "'.$motdepasse_verif."'");
// SI AUCUN ENREGISTREMENT NE CORRESPOND
if(mysql_num_rows($req)==0)
{
echo "Aucun utilisateurs ayant le mot de passe saisi existe. Reéssayer";
}
// SI LE LOGIN ET MOT DE PASSE SONT EXACTES
else
{
$_SESSION['matriculeAgent'] = $row['matriculeAgent'];
$_SESSION['motdepasseAgent'] = $row['motdepasseAgent'];
// REDIRECTION VERS UNE PAGE PROTEGEE
header("Location:accueil.php");
// selection de lenregistrement saisie a la page login.php
}
}
else{
echo "veuillez saisir le motdpass";
}
This are the errors I am getting:
Notice: Undefined index: matriculeAgent in C:\Users\admin\Dropbox\EasyPHP-DevServer-14.1VC9\data\localweb\esmcm\dossier\makeLogin.php on line 25
Notice: Undefined index: motdepasseAgent in C:\Users\admin\Dropbox\EasyPHP-DevServer-14.1VC9\data\localweb\esmcm\dossier\makeLogin.php on line 27