I suspect this question is asked before but I am having trouble wording it in one sentence so apologies if it is a duplicate but I did ask Google quite a lot but getting answers totally irrelevant to what I am trying to find out.
A bit of context I have a bunch of html and php files that deal with authentication. I have a login.html form that calls home.php which (1) authenticates user based on username and password and then (2) displays home screen. So the home.php has the following variable assignments:
$username = $_POST[“username”];
$password = $_POST[“password”];
The problem is when I am using a different file “change_password.php” which is called from a form in “change_password.html.” In the php file, there are only three variables: $oldpword, $newpword and $newconfirmationpword which is all I need to change password. And once the password is successfully changed, I expect the user to press the “home” button (home.php).
However, when the home button is selected and the home.php file is run, I get an error saying that the variable $username and $password is undefined. I suspect it is because the form that called the change_password.php file did not have $username and $password variables in their <input>
element. As such, when the two assignment codes are run, the $_POST[] variables are empty (or undefined).
Is there a way around this? My ultimate aim is to get rid of the undefined errors.