Pass variable from one page to another
How can I get the value of a variable from the previous page to the current page?
I'm currently creating a login system in PHP. I have 3 files; login.php, checklogin.php, and main.php.
Flow: login.php --- checklogin.php --- main.php
I have a variable inside checklogin.php named as $id.
I assigned value to it:
$id=$_POST['id_number']; //id_number is the name of the textfield in login.php
Now, I want to assign the value of $id from checklogin.php to variable $id_num from main.php and print the value.
Re: Pass variable from one page to another
use sessions or cookies to store the value in checklogin.php once you have cleared the user as being able to login.
then, in main.php you can just check if the session or cookie exists and is valid. if not, redirect to login page or something of that sort.