Note that there are some explanatory texts on larger screens.

plurals
  1. POphp log in form with messages and date and time
    primarykey
    data
    text
    <p>I am trying to create a php log in form. I want to just make a few adjustments but when i've tinkered with it, it stops working...</p> <p>If you can't see from the code, I'm trying to create a (mock) log in form that asks for a username and password. </p> <ul> <li><p>I want any blank textbox to show a red message to the right of the textbox. (i have the red error message, but I can't get it to the left of the box) </p></li> <li><p>I want a sticky form that keeps either field if its filled in (again, I think I have this set up but don't think its working all the way)</p></li> <li><p>I would like a person who enters the username: <strong>user</strong> and the password: <strong>abc123</strong> to see a welcome message. If you don't use that username/password combo I want a message that says that they are not authorized. (This is what i really don't know how to do)</p></li> <li><p>I want this all in a redux (also think i have that working but not 100% sure)</p></li> </ul> <p>Any help would be greatly apprecaited!! </p> <p>And here is my code:</p> <pre><code>&lt;?php define('TITLE', 'LOG IN'); // CSS print '&lt;style type="text/css" media="screen"&gt; .error { color: red; } &lt;/style&gt;'; // Checking if ( isset($_POST['submitted']) ) { $problem = FALSE; // Each value if (empty($_POST['email'])) { $problem = TRUE; print '&lt;p class="error"&gt;Please enter the username!&lt;/p&gt;'; } if (empty($_POST['password1'])) { $problem = TRUE; print '&lt;p class="error"&gt;Please enter the password!&lt;/p&gt;'; } if (!$problem) { //No problem // Printing the log in message print '&lt;p&gt;Thank you for logging in!&lt;/p&gt;'; $_POST = array(); } else { print '&lt;p class="error"&gt;No entry!&lt;/p&gt;'; } } ?&gt; &lt;form action="login.php" method="post"&gt; &lt;p&gt;"Username": &lt;input type="text" name="username" size="20" value="&lt;?php if (isset($_POST['username'])) { print htmlspecialchars($_POST['username']); } ?&gt;" /&gt;&lt;/p&gt; &lt;p&gt;Password: &lt;input type="password" name="password1" size="20" /&gt;&lt;/p&gt; &lt;p&gt;&lt;input type="submit" name="submit" value="Log in" /&gt;&lt;/p&gt; &lt;input type="hidden" name="submitted" value="true" /&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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