PHPiSean Posted August 22, 2011 Share Posted August 22, 2011 So basically I've been experimenting with setting cookies and sessions. The code in my header file will display a login if there is no $_SESSION['username']. However, the else statement verifies that there is, and echo's "hello." My problem lies in the else statement, when the login form disappears, but nothing in the else statement appears. Here's the code, I feel like I am missing something obvious. <?php if (!isset($_SESSION['username'])){ echo "<li><a href='register.php'>Register</a></li>"; echo "</ul>"; echo " <table> <tr> <form name='login' method='post' action='login.php'> <tr><td>Username</td> <td><input type='text' name='username'></td></tr> <tr><td>Password</td> <td><input type='password' name='password'></td></tr> <tr><td><input type='submit' name='submit' value='Login'></td></tr> <tr><td><input type='checkbox' name='rememberme' value='remember'> Remember</td></tr> </form> </table> "; }else{ echo "hello"; } ?> Thanks in advance Link to comment https://forums.phpfreaks.com/topic/245399-problem-with-if-statement/ Share on other sites More sharing options...
PHPiSean Posted August 22, 2011 Author Share Posted August 22, 2011 Also, I do have <?php ini_set('session.cookie_domain','.suriak.com')?> <?php session_start(); ?> I just cut it out and went to the statement Link to comment https://forums.phpfreaks.com/topic/245399-problem-with-if-statement/#findComment-1260381 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.