Note that there are some explanatory texts on larger screens.

plurals
  1. POLog in form on the top right headers content
    text
    copied!<p>i made a log in form in header on the top right side with the other contents like search bar and logo</p> <p>and i have a plan when i logged in the other headers content is stand still but only the log in content is changing to the Logged in content</p> <p>and here is my code that i assume have no problem at all</p> <p>PHP code</p> <pre><code>if(empty($_POST) === false){ $username = $_POST['input-username']; $password = $_POST['input-password']; if(empty($username) === true || empty($password) ===true){ $errors[] = 'You Need To Enter a Username And a Password'; } else if(user_exists($username) === false){ $errors[] = 'We Can\'t Find That Username'; } else{ $login = login($username, $password); if($login === false){ $errors[] = 'Your Username and Password Combination is Incorrect'; } else{ $_SESSION['user_id'] = $login; header("Location: index.php"); } } print_r($errors); } </code></pre> <p>HTML Script</p> <pre><code> &lt;form method="post" action="index.php" name="signin-form"&gt; &lt;table border="1"&gt; &lt;tr&gt; &lt;td&gt;Username&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="input-username" id="input-username"&gt;&lt;/td&gt; &lt;td&gt;Password&lt;/td&gt;&lt;td&gt;&lt;input type="password" name="input-password" id="input-password"&gt;&lt;/td&gt; &lt;td&gt; &lt;input type="submit" name="sign-in" id="sign-in" value="Log in"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2"&gt; &lt;input type="checkbox" name="remember-me"&gt; &lt;label id="information"&gt;Keep Me Eating Picture&lt;/label&gt; &lt;/td&gt; &lt;td colspan="2"&gt; &lt;a href="#" id="forgotpass"&gt;Forgotten My Username or Password&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>but somehow the condition is getting weird after i input the username and password why that i should click the submit button twice in the log in content to redirect to logged in content?</p> <p>like this: username obink password obink and enter</p> <p><strong>first log in</strong> is nothing happened but the username field and password field are empty <strong>the second log in</strong> with the blank fields of username and password is the time to redirect the log in content to the logged in content</p> <p>is it my code is going wrong or what? i had trying to rebuild the css but there is nothing happened. And ow ya, i have users function page already, it is the page which is storing any function what i need</p> <p>here is the headers content design more or less:</p> <p>div logo</p> <p>div search box</p> <p>and div user log in or not like this</p> <pre><code> if (logged_in($user_data['user_id']) === false){ include 'login.php'; } else{ include 'logged_in.php'; } </code></pre> <p>all is float left</p> <p>and the php in the user functions</p> <pre><code>function logged_in(){ return (isset($_SESSION['user_id'])) ? true : false; } </code></pre> <p>in my source.php page</p> <pre><code> if(logged_in() === true) {$sid = $_SESSION['user_id']; $user_data = user_data($_SESSION['user_id'], 'user_id', 'username', 'password', 'firstname', 'lastname', 'email'); } </code></pre> <p>renew the condition on my headers html on headers</p> <pre><code> &lt;div id="header"&gt; &lt;div id="header-content"&gt; &lt;div id="logo"&gt; &lt;a href="index.php" style="text-decoration:none;"&gt; logo&lt;/a&gt; &lt;/div&gt; &lt;div id="searchbox"&gt; &lt;input type="text" placeholder="Search" size="50"&gt; &lt;/div&gt; </code></pre> <p>php on the middle of headers</p> <pre><code>if(empty($_SESSION['user_id'])){ include 'includes/widgets/login.php'; } else{ include 'includes/widgets/loggedin.php'; } </code></pre> <p>closing div</p> <pre><code>&lt;/div&gt; &lt;/div&gt; </code></pre> <p>sorry for my English</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload