I am new to PHP and need help. I have login form and I am sending username and password using POST method. How to extract data on my .php page and remember that user is logged in ( my username and password are hardcodded in code ) ? Do I need to store this on hd ( it is on embedded plc so I cannot use HD to store information )?
Share
Extracting post data is easy:
<?php echo $_POST['fieldname']; ?>Remembering the logged-in user is a bit trickier.
You have to call
session_start()at the beginning of your script, so you can store the user-related stuff in between web requests like this:$_SESSION['logged_in'] = true;. You don’t have to store the data on hard disk, PHP provides a function for you to set callbacks to handle session saving and restoring.You can read more about it here.