I am not able to set the session variable. on the firstpage.php
Code: Select all
<?php
session_start();
?>
<?php
//print("<form method=post action=thispage.php>");
//goes here whne the student hits submit
if(isset($student_number))
{
print("<form method=post action=thispage.php>");
$file_name = file('student_number.txt');
//check the student number
for ($i=0; $i<count($file_name); $i++)
{
if(!strcmp($student_number_value+"",$file_nameї$i]+""))
{
$valid_student_no='1';
$student_number = $student_number_value;
print("$student_number");
break;
}
else
{
$valid_student_no='0';
}
}
}
if($valid_student_no=='0')
{
print("Invalid student number, redirecting you to proper page.");
session_unset();
//session_destroy();
?>
<head>
<meta HTTP-EQUIV="REFRESH" content="1; url=someurl">
</head>
<?php
}
else if($valid_student_no=='1') {
print("Please wait redirecting...");
?>
<head>
<meta HTTP-EQUIV="REFRESH" content="1; url=nextpage.php">
</head>
<?php
}
else{
print("<form method=post action=brooks.php>");
//first page that the users will encounter.
$_SESSIONї'valid_student_no']="";
$_SESISONї'student_number']="";
?>
Please enter your student number: <input type= "text" name="student_number_value" maxlength="7">
<br><br>
<input type="submit" name="student_number" value="Submit"> <input type="reset">
<?php
print("</form>");
}
?>Code: Select all
<?php
//start session
session_start();
print("<form method=post action=nextpage.php>");
print("Welcome to brooks system. $student_number");
//mechanism to check if the profile is created or not.
//depending on that give them the options.
?>Help will eb appreciated..
Tanmay