The idea/goal:
I have a username and password inside a text file on my computer. The form on the index page allows the user to sign in with their us
Use $_SESSION -!
session_start();
$_SESSION['username'] = $_POST['username'];
You of course want to filter/sanitize/validate your $_POST data, but that is outside of the scope of this question...
As long as you call session_start(); before you use $_SESSION - the values in the $_SESSION array will persist across pages until the user closes the browser.
If you want to end the session before that, like in a logout button --- use session_destroy()