Basically I need some serious help on this one, last one. I am really confused.
How can I get my yearofbirth, month of birth and day of birth from my login page, with only having Username/Password as login??

Just basically, creating a

$_SESSION = ['age'] = The age of the user( after getting the ifnromation from $yearofbirth, $monthofbrith, $dayofbrtih from the database;

calculating it from the current year???I am so confused...Thanks :(

So i have a form.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">

write_head("Login Page", "newCSS");


<div id    ="body"    >
<div id    ='sidebar' > <form method='post' action='login.php'>
<label for = 'username'> Username:</label>
<input name='username' id='username'/><br/>  
<label for = 'password'>Password:</label>
<input name='password' id='password'/><br/>
<input type='submit'  value='Log in' /></form>
<!--end of login page -->

//prevent sql injesctions
error_reporting (E_ALL ^ E_NOTICE);
// for error handling

$uname 	= $_POST["username"];
$pword 	= $_POST["password"];
$ybirth = $_POST["yearofbirth"];
$num_rows = 0;
$errorMessage = "";
$uname  = htmlspecialchars($uname);
$pword  = htmlspecialchars($pword);
$ybirth = htmlspecialchars($ybirth);

    echo "ERROR: Input contains characters other than letters and numbers.";

$conn = mysql_connect("localhost", "root", "") or die("cannot connect"); 
mysql_select_db("") or die (mysql_error());

$sql = ("SELECT * FROM sc_users WHERE username = '$uname' and password = '$pword' and yearofbirth='$ybirth'");
$result = mysql_query ($sql);

$errorMessage = "Error logging on";

    echo "ERROR - No mactching rows from the database!<br/>";
	$sql_check = "SELECT * FROM sc_users WHERE (username = '$uname' and password='$pword' AND isadmin= 1)";
	$sql_result = mysql_query($sql_check) or die(mysql_error());
		$_SESSION['gatekeeper'] = $_POST["username"];
		$_SESSION['agez'] = $_POST["yearofbirth"];
		header("Location: mainpage.php");
	$_SESSION['gatekeeper'] = $_POST["username"];
	$_SESSION['admin']      = $_POST["username"];
	$_SESSION['agez'] = $_POST["yearofbirth"];
		header("Location: newfilm.php");

    // Redirect to the main menu
	$errorMessage = "logged on";


You can't get it from your login page - you need to retrieve it from the database once they have logged in correctly. Everything in your code is relying on the user inputting their year of birth in the login form and posting it through.

Be a part of the DaniWeb community

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