View Single Post
  #1 (permalink)  
Old April 4th, 2013, 06:30 PM
Old Sarge Old Sarge is offline
Registered User
Points: 26, Level: 1
Points: 26, Level: 1 Points: 26, Level: 1 Points: 26, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Leson 6 Php and mysql 24-hour

I'm having trouble with the following code (I'm using eclipse and it gives no errors):

Code:
<?php
 /**
* lesson06z.php 
* 
* @version 		1.2 2011-02-03
* @package		Smithside Auctions
* @copyright	Copyright (c) 2011 Smithisde Auctions
* @licnese		GNU General Public license
* @since		Since Release 1.0
*/ 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Cp1252">
<title>Post Data</title>
</head>
<form action="lesson06z.php" method="post">
    <label for="username">User Name:</label><br />
    <input type="text" id="username" name="username" /><br />
    <label for="password">Password</label><br />
    <input type="text" name="password" /><br />
    <br />
    <button type="submit">Submit</button>
</form>
<br />
<p> You entered <?php echo $_POST["username"] ?> as the User Name and <?php echo $_POST["password"] ?> as the Password </p>
</body>
</html>
When I run the routine wilth "localhost/php24/lesson06z.php" the blank User Name block and blank Password blocks come up but I also have the following errors:

You entered
Notice: Undefined index: username in C:\Users\chuck\Desktop\Documents\php\xampp\htdocs\ php24\lesson06z.php on line 27
as the User Name and
Notice: Undefined index: password in C:\Users\chuck\Desktop\Documents\php\xampp\htdocs\ php24\lesson06z.php on line 27
as the Password

However, when I fill in the blank fields and transmit, I get the correct response with no errors:

You entered chuck as the User Name and sdkjfjfkaf as the Password

What am I doing wrong?
Reply With Quote