hi!
I'm making a student registration system using mysql and php.The first page has the username and password for admin/employee log-in, and i've used session for that entry.
With the employee log-in, the second page has the Student ID entry and i used session for this also, but im getting errors.I want to know how to use a session inside another session.I may be wrong in doing this as im using php for the first time, or is it that, we have to declare all the sessions together or something like that, which im not sure,but would appreciate if anyone could help me with the exact syntax.thanks! (* the first session is for the admin/employee log-in, and the second one is for the student ID).
php sessions
Moderator: General Moderators
I would put it this way;
Once logged in as an employee and authenticated via database, set session var for it.Inside the next page (student id entry) just set another var for it inside same session.
Send studentID from form to page itself and set it as session var:
Once logged in as an employee and authenticated via database, set session var for it.
Code: Select all
<?php
$_SESSION['login_employee'] = "true";
?>Send studentID from form to page itself and set it as session var:
Code: Select all
<?php
if(isset($_SESSION['login_employee'])) #check employee login
{
if(isset($studetID))
{
$_SESSION['studentID'] = $studentID;
}
print_student_form(); # student form function, action: PHP_SELF
}
else
{
header("location:loginpage.php?message=unauthorized"); #redirect to login page if session is not set.
}
?>php session
thanks,
i will try and see if it works!
i will try and see if it works!