Error To use $submit and variables html control

From: Date: Tue, 04 May 2004 07:44:01 +0000
Subject: Error To use $submit and variables html control
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-24548@lists.php.net to get a copy of this message
in the name of god. hello. my to use this cod send error for me: Code:Login.php: <?php // Attempt to fetch the form variables $username = $HTTP_POST_VARS['username']; $password = $HTTP_POST_VARS['password']; // If the username and password are valid, // redirect the user to the search page. if (isset($username) && isset($password)) { // Connect to the database $conn = mysql_connect('localhost', 'root', '') or die(mysql_error()); mysql_select_db('Library', $conn) or die(mysql_error()); // Query the database $sql = "SELECT username FROM users WHERE username = '" . $username . "' and password = '" . $password . "'"; $result = mysql_query($sql, $conn); // Test the query result $success = false; if (@mysql_result($result, 0, 0) == $username) { $success = true; } // Close the connection to the database mysql_close($conn); // Redirect the user upon a success login if ($success) { header('Location: search.php'); } } ?> <html> <head> <title>Online Library - Login</title> </head> <body bgcolor="#ffffff" text="#000000"> <h2>Online Library - Login</h2> <?php if (isset($success) && !$success): ?> <div style="color: #cc0000"><b>Login failure!</b></div> <?php endif; ?> <form action="login.php" method="POST"> Username: <input name="username" type="text" /><br /> Password: <input name="password" type="password" /><br /> <input type="submit" value="Log in" /> </form> </body> </html> ... This Error Send PHP Compiler: Notice: Undefined index: username in d:\inetpub\wwwroot\php4\Ch17\login.php on line 4 Notice: Undefined index: password in d:\inetpub\wwwroot\php4\Ch17\login.php on line 5 . Thanks. Please Send Message In this Cod: mailto:asabet2003@hotmail.com

« previous php.mirrors (#24548) next »