0

Here is the code for my login page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<style type="text/css">
#apDiv1 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
    left: 608px;
    top: 201px;
}
#apDiv1 form table tr td {
    font-family: "Trebuchet MS";
}
</style>
</head>

<body>

<div id="apDiv1">
<form method ="post" action="login.php">
    <table width="300" border="0">
      <tr>
        <td width="134">Username:</td>
        <td width="156"><input type="text" name='username'/></td>
      </tr>
     <tr>
        <td><p>Password:</p></td>
        <td><p>
          <input type="password" name="password"/>
        </p></td>
      </tr>
      <tr>
      <td callspan"2"><input type="submit" name="submit" value="Login"/> </td>
      </tr>
          </p>

        </table>
  </form>
  </div>
  <?php
include"config.php";

mysql_connect($dbhost, $dbusername, $dbpassword) or die(mysql_error());
mysql_select_db($dbname) or die(mysql_error());

if($_POST["submit"]){

$myusername = ($_POST['username']);
$mypassword = ($_POST['password']);

if((!$myusername) || (!mypassword)){
    echo "Please fill in all fields!";
    exit;
}

    $sql = "SELECT * FROM {$dbtable} WHERE username ='{$myusername}' AND password='{$mypassword}'";
    $result = mysql_query($sql);

    $count = mysql_num_rows($result);

    if($count == 1){
        $_SESSION['username'] = $myusername;
        $_SESSION['password'] = $mypassword;
        $_SESSION['userrecord'] = mysql_fetch_assoc($result);

        echo "SUCCESSFUL! Click here to <a href='account.php'>Login</a>";

    }
}

?>

</body>
</html>

My output is telling me that I have an unidentified index here:

if($_POST["submit"]){

What does this mean and how do I fix this?

Thank you.

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by oldezwe
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.