Alex1646 Posted February 20, 2011 Share Posted February 20, 2011 I get this errr message Notice: Undefined index: user in C:\wamp\www\Login\login.php on line 25 Here is line 25: $_SESSION['user'] == $form_username ; Here is the whole page. <?php session_start(); ?> <html> <head> <title>Login</title> <?php include('logic.inc'); ?> </head> <body> <?php if (!isset($_POST['user_name']) && isset($_POST['password'])) { die("Please enter both a username and password"); } $form_username = $_POST['user_name']; $form_password = $_POST['password']; mysqlConnect(); loginvar(); if($passdb = $form_password && $userdb = $form_username) { $_SESSION['user'] == $form_username ; echo "<hr />"; echo "Login Sucssesful <br /> "; echo '<a href="/login/index.php">Return Home</a>'; } else { die("User name does not match password"); } ?> </body> </html> Hellp! Link to comment https://forums.phpfreaks.com/topic/228248-i-am-having-trouble-with-sessions-getting-a-error-help/ Share on other sites More sharing options...
Zurev Posted February 20, 2011 Share Posted February 20, 2011 Change it to session[user] = $form_username One equals sign. Let me know if that fixes it, should. Link to comment https://forums.phpfreaks.com/topic/228248-i-am-having-trouble-with-sessions-getting-a-error-help/#findComment-1177023 Share on other sites More sharing options...
cgsmith105 Posted February 20, 2011 Share Posted February 20, 2011 You have to change the other equal signs as well! Please read http://us3.php.net/manual/en/language.operators.assignment.php Link to comment https://forums.phpfreaks.com/topic/228248-i-am-having-trouble-with-sessions-getting-a-error-help/#findComment-1177024 Share on other sites More sharing options...
denno020 Posted February 20, 2011 Share Posted February 20, 2011 As said above, you're using the comparator equals signs, not assigning. You typed them fine when assigning the post variables, so I'm not sure why you would have changed? Denno Link to comment https://forums.phpfreaks.com/topic/228248-i-am-having-trouble-with-sessions-getting-a-error-help/#findComment-1177030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.