function message()
{
if (isset($_SESSION['message'])) {
if ($_SESSION['message'] == "signup_err_password") {
echo " <div class='alert alert-danger' role='alert'>
please enter the password in correct form !!!
</div>";
unset($_SESSION['message']);
} elseif ($_SESSION['message'] == "loginErr") {
echo " <div class='alert alert-danger' role='alert'>
The email or the password is incorrect !!!
</div>";
unset($_SESSION['message']);
} elseif ($_SESSION['message'] == "usedEmail") {
echo " <div class='alert alert-danger' role='alert'>
This email is already used !!!
</div>";
unset($_SESSION['message']);
} elseif ($_SESSION['message'] == "wentWrong") {
echo " <div class='alert alert-danger' role='alert'>
Something went wrong !!!
</div>";
unset($_SESSION['message']);
} elseif ($_SESSION['message'] == "empty_err") {
echo " <div class='alert alert-danger' role='alert'>
please don't leave anything empty !!!
</div>";
unset($_SESSION['message']);
} elseif ($_SESSION['message'] == "signup_err_email") {
echo " <div class='alert alert-danger' role='alert'>
please enter the email in the correct form !!!
</div>";
unset($_SESSION['message']);
}
}
}
This kind of error is displayed were ever i use this message function
the same message is displayed wen eve i tried to import the message function in the program
3
Answers
I believe next code snippet will help you. First of all you have saw an error because you don’t ensure element with that index exists. Secondary, I have refactore the code to make it easily to read and extend, please take a look
there are no errors in the code you provided. most likely you copied it from the wrong file. Or maybe you didn’t have this check before
then you added it and forgot to upload it to your server.