Hey
I am having a small problem with setting and storing data using $_SESSION for a login script to validate that a user is logged in.
The outputted error message I'm getting is;
Notice: Undefined index: userid ...\...\
Notice: Undefined variable: userid in ...\...\
The PHP code I'm using for the validation
<?php
session_start(); //must call session_start before using any $_SESSION variables
$username = $_POST['username'];
$password = $_POST['password'];
$userid = $_POST['userid'];
//validating a user
function validateUser()
{
session_regenerate_id (); //this is a security measure
$_SESSION['valid'] = 1;
$_SESSION['userid'] = $userid;
}
Let me know if you need any other bits of code to establish what is happening I really need help with this.
Thanks.