View Full Version : Login Tutorial Help.

03-03-2009, 08:46 AM
Hi Everyone!

Just started getting into learning more about PHP and the video's so far are a great help to me personally because I am a visual learner. I know this question was previously asked, but the person that asked for helped jumped around so much when getting professional help it made it confusing for me to follow along to find the fix.

I am getting...

Notice: Undefined index: userid in C:\wamp\www\website\login.php on line 5

Notice: Undefined index: password in C:\wamp\www\website\login.php on line 6

Notice: Undefined index: submitted in C:\wamp\www\website\login.php on line 7

Notice: Undefined variable: rowAccount in C:\wamp\www\website\login.php on line 17

Here is my code:

require_once("Connections/connection.php"); // database connection
// Catch Field Data
$userid = $_POST['userid'];
$password = $_POST['password'];
$submitted = $_POST['submitted'];
if ($userid && $password){
$query = sprintf("SELECT * FROM users where user_name='$userid' and user_password = '$password'");
$result = @mysql_query($query);
$rowAccount = @mysql_fetch_array($result);
if ($rowAccount){

echo "The record exists you may enter";

echo "You do not exist in the system, access denied!";

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<form id="form1" name="form1" method="post" action="<?php $_SERVER ['PHP_SELF'];?>">
<table width="268" border="1" align="center">
<td width="101">Username :</td>
<td width="151"><label>
<input type="text" name="userid" id="userid" />
<td>Password :</td>
<input type="text" name="password" id="password" />
<td align="center"><input name="submitted" type="hidden" id="submitted" value="1" />
<input type="submit" name="button" id="button" value="Submit" /></td>

I believe everything is in order from what was shown in the video's. If i go to input data and hit submit it works just fine and does show the correct results, it just so happens that on the initial viewing of the page, it shows those errors.

Thanks a bunch!

03-03-2009, 08:51 AM

03-03-2009, 09:15 AM

Thank you for a speedy reply. php.ini was changed

error_reporting = E_ALL & ~E_NOTICE

Thanks again,