I've been looking at this now for a few hours and I'm unable to see why the error is occurring. I've only started php recently so it may be a rookie error however it has thrown me.
I've tried changing all ' to " and placing & after each deceleration, all to no avail.
Can anyone cast an idea as to why?
The file is called register.php and the errors are as following:
Notice: Undefined index: submit in C:\xampp\htdocs\xampp\register.php on line 3
Notice: Undefined index: username in C:\xampp\htdocs\xampp\register.php on line 6
Notice: Undefined index: first_name in C:\xampp\htdocs\xampp\register.php on line 7
Notice: Undefined index: second_name in C:\xampp\htdocs\xampp\register.php on line 8
Notice: Undefined index: password in C:\xampp\htdocs\xampp\register.php on line 9
Notice: Undefined index: repeat_password in C:\xampp\htdocs\xampp\register.php on line 10
Notice: Undefined index: email in C:\xampp\htdocs\xampp\register.php on line 11
<?php
$submit = $_POST['submit'];
//input data
$username = strip_tags($_POST['username']);
$first_name = strip_tags($_POST['first_name']);
$second_name = strip_tags($_POST['second_name']);
$password = strip_tags($_POST['password']);
$repeat_password = strip_tags($_POST['repeat_password']);
$email = strip_tags($_POST['email']);
if ($submit){
if($username&&$first_name&&$second_name&&$password&&$repeat_password&&$email)
{
$password = md5($password);
$repeat_password=md5($repeatpassword);
if (strlen($username)>10)
{
if (strlen($first_name)>10)
{
if (strlen($second_name)>15)
{
if ($password==$repeat_password)
{
if (strlen($password)>10)
{
echo "sucsess!";
}
else
{
echo "Password too long";
}
}
else
{
echo "Passwords doesn't match.";
}
}
else
{
echo "Second name is too long.";
}
}
else
{
echo "First name is too long.";
}
}
else
{
echo "Username is too long.";
}
}
else
{
echo "Please fill in all fields.";
}
}
?>
<head>
<title>Joe Steer N0261182</title>
<link href="items/html.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="main">
<div id="top"></div>
<div id="navigation">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="books.php">Books</a></li>
<li><a href="cart.php">Shopping Cart</a></li>
<li><a href="account.php">Account</a></li>
<li><a href="login.php">Log In</a></li>
<li><a href="register.php">Register</a></li>
</ul>
</div>
<div id="content">
<p>
<form action='register.php' method='POST'>
<table>
<tr>
<td>
Username
</td>
<td>
<input type='text' name='username'/>
</td>
</tr>
<tr>
<td>
First Name
</td>
<td>
<input type='text' name='first_name'/>
</td>
</tr>
<tr>
<td>
Second Name
</td>
<td>
<input type='text' name='second_name'/>
</td>
</tr>
<tr>
<td>
Password
</td>
<td>
<input type='password' name='password'/><br />
</td>
</tr>
<tr>
<td>
Confirm Password
</td>
<td>
<input type='password' name='repeat_password'/><br />
</td>
</tr>
<tr>
<td>
Email
</td>
<td>
<input type='text' name='email'/><br />
</td>
</tr>
</table>
<input type = 'submit' name = 'submit' value = 'Register' />
</form>
</p>
<p> <br />
</p>
</div>
<div id="footer">
© Joe Steer<br/><a href="logout.php">Log Out</a></div>
</div>
</div>
</body>
</html>
Paste bin if anyone prefers looking at it that way:
http://pastebin.com/Kq9RpZ95
Many thanks.