I dont understand why im having such a problem with this. Its still saying the variables on the updates file arent being recognised. So the session isnt being started on the login file. I dont understand why im having such a problem with this. Here are what the files are now
This is login.php
PHP Code:
<?php
include("head.php");
if (!$_POST['user'] || !$_POST['pass']) {
print "Please fill out all fields.";
include("foot.php");
exit;
} else {
$user = mysql_real_escape_string($_POST['user']);
$pass = mysql_real_escape_string($_POST['pass']);
$logres = mysql_num_rows(mysql_query("select * from members where user='$user' and pass='$pass'"));
if ($logres <= 0) {
print "Login failed. If you have not already, please signup. Otherwise, check your spelling and login again.";
include("foot.php");
exit;
} else {
session_start();
$stat = mysql_fetch_array(mysql_query("select * from members where user='$user' and pass='$pass'"));
print " <br>Welcome back $stat[user] . Please click <a href=updates.php>here</a> to continue..";
}}
include("foot.php");
?>
And this is updates.php
PHP Code:
<?php
session_start();
include"config.php";
$user = mysql_real_escape_string($_POST['user']);
$pass = mysql_real_escape_string($_POST['pass']);
$stat = mysql_fetch_array(mysql_query("select * from members where user='$user' and pass='$pass'"));
print"Welcome $stat[user]";
?>
The error im getting on updates.php is
( ! ) Notice: Undefined index: user in C:\wamp\www\updates.php on line 4
Call Stack
# Time Memory Function Location
1 0.0009 674216 {main}( ) ..\updates.php:0
( ! ) Notice: Undefined index: pass in C:\wamp\www\updates.php on line 5
Call Stack
# Time Memory Function Location
1 0.0009 674216 {main}( ) ..\updates.php:0
How do I make the session register properly on login.php and continue over to updates.