Young books I need help! HTML/PHP

TrueJewix

Member
Aug 9, 2012
332
21
Okay, long story short : I want a red text below the "login box" to say "Hey! Your username or Password is wrong!"

Screen shots :




Now I want this; whenever a user does the username/password wrong I want a red text below!!! to say "I want a red text below the "login box" to say "Hey! Your username or Password is wrong!" not to re-direct them to another site.. Thanks :up:
 

Zodiak

recovering crack addict
Nov 18, 2011
450
411
PHP:
if($username == "Jack" && $password == "")
{
      //Start a session
      echo "Welcome";
}
else
{
       $error = 'Hey! Your username or Password is wrong!';
}

then to display the error:
PHP:
if($error)
{
   echo '<div id="errorboxid">'.$error.'</div>';
}
 

TrueJewix

Member
Aug 9, 2012
332
21
PHP:
if($username == "Jack" && $password == "")
{
      //Start a session
      echo "Welcome";
}
else
{
       $error = 'Hey! Your username or Password is wrong!';
}

then to display the error:
PHP:
if($error)
{
   echo '<div id="errorboxid">'.$error.'</div>';
}
Gives me a error ?_?
 

Zodiak

recovering crack addict
Nov 18, 2011
450
411
if the code is on the same page as the form delete action="area.php" and put:
Code:
<?php

if(isset($_POST['username']) && isset($_POST['password']))
{
  //Put the code I gave you here
}

?>
 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
Well you have to define the $username variable...

As Zodiak said

PHP:
if(isset($_POST['username']) && isset($_POST['password'])) {
  if($username == "Jack" && $password == "") {
    echo "Welcome";
  } else {
  $error = 'Hey! Your username or Password is wrong!';
  }
}
if($error) {
echo "<div id=\"errorboxid\">{$error}</div>";
}
 
Last edited:

TrueJewix

Member
Aug 9, 2012
332
21
if the code is on the same page as the form delete action="area.php" and put:
Code:
<?php

if(isset($_POST['username']) && isset($_POST['password']))
{
  //Put the code I gave you here
}

?>
"Notice: Undefined variable: username in /Applications/XAMPP/xamppfiles/htdocs/index.php on line 64"
 

Users who are viewing this thread

Top