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.
?>

The first step is to create a form. You would have a few controls, one for the student number, and another for birthday. I suggest a text box to enter the student # and a set of combo boxes (one for the month/day/year) and then a submit button to handle the form processing. Before the form is submitted, check that the input is validated.

first a form to enter and submit the student no and birthday then a table or a div to display the results in the other page.

solved or??

The first step is to create a form. You would have a few controls, one for the student number, and another for birthday. I suggest a text box to enter the student # and a set of combo boxes (one for the month/day/year) and then a submit button to handle the form processing. Before the form is submitted, check that the input is validated.

yeah..i've already have it form for the student # as well as birthday..2 textbox and 1 submit button..i have my database already. i know the problem lies on the codes i gave..but i dont know what it is..

first a form to enter and submit the student no and birthday then a table or a div to display the results in the other page.

solved or??

Could you pls recode my coding above..I know the problem lies on my codes i've gave..i have my form and submit button as well as my database..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.