These lines cause the "undefined index" warnings.
$username = $_POST['user_name'];
$password = $_POST['password'];
$type = $_POST['user_type'];
When you submit a form to this script, $_POST
is an array containing all the form elements. In your case the user_name
, password
and user_type
form elements did not exist, or you did not submit a form. Thus, the array elements do not exist. When you try to read from a nonexistant array element, you get the "Undefined Index" notice.
The other warning is caused by this line:
$count = mysql_numrows($info);
You're passing $info
, an array, to mysql_numrows
. You should be passing it a result resource from a mysql_query. You should be passing $data
to mysql_numrows
.