i want to be able to store the user ID into the session. How would i do that? I think the problem is below. $user_info = mysql_fetch_array($result); $id = stripslashes($user_info['id']); if($count==1){ // if user login is successful then create session $_SESSION['email']=$email; $_SESSION['id']=$id; echo "<meta http-equiv='refresh' content='0;url=member_home.php'>"; }else { // if user login is wrong direct to failed.php session_destroy(); echo "<meta http-equiv='refresh' content='0;url=failed.php'>"; } Code (markup): and the code i would use to reveal it on the next page would be... $_SESSION['id']=$id; echo $id; Code (markup): but its not working......
As Morishani pointed out, you would need session_start(); before you attempt to do any other session stuff. Also, might I ask if it's required that you redirect with a meta tag like that? Does it have to put other stuff on the page too that you're doing it that way? Have you thought of redirecting with PHP instead using header("Location: failed.php"); ? Would be much quicker.