This is the codes i used in my login based on it's database.It works well.But i forgot something..I want to post the current user when he/she login.When they enter their student # as well as their birthday in the login menu,then when they click the button,the information of the current user must display or post on the left side of my webpage.Student #,name,course,year,abd department that saved on the database should appear in my webpage.How can i do that? tnx in advance..
This is the code in checking the login..
1.
<?php
2.
$host="localhost";
3.
$name="root";
4.
$password="";
5.
$db_name="records";
6.
$tbl_name="students";
7.
8.
mysql_connect("$host", "$name", "$password")or die("cannot connect");
9.
mysql_select_db("$db_name")or die("cannot select DB");
10.
11.
$studno=$_POST;
12.
$birthday=$_POST;
13.
14.
$studno = stripslashes($studno);
15.
$birthday = stripslashes($birthday);
16.
17.
$studno = mysql_real_escape_string($studno);
18.
$birthday = mysql_real_escape_string($birthday);
19.
20.
$sql="SELECT * FROM $tbl_name WHERE studno='$studno' and birthday='$birthday'";
21.
$result=mysql_query($sql);
22.
23.
$count=mysql_num_rows($result);
24.
25.
if($count==1){
26.
27.
session_register("studno");
28.
session_register("birthday");
29.
header("location:selectvoter_candidates.php");
30.
}
31.
else {
32.
echo "Invalid Student No. or Birthday!";
33.
}
34.
?>