Mysql Button help

I was following this guys tutorial on how to make a Registration page

and i dont kow why i get this error it wont get sent to MySQL it has something to do with the button could you help me out. the error says
Notice: Undefined index: button in C:\Server\Minecraft\HTML\Registration.php on line 123

<?php $button = $_POST['button']; if ($button) { $username = $_POST['username']; $password = $_POST['password']; $email = $_POST['email']; $retypepassword = $_POST['retypepassword']; $minecraft_username = $_POST['minecraft_username'];
if ($username && $password && $retypepassword && $email && $minecraft_username)
{
	if ($password == $retypepassword)
	{
		if (strstr($email, "@") && strstr($email, "."))
		{
			include ("connect.php");
			$query = mysql_query ("SELECT * FROM users WHERE username='$username'");
			$numrows = mysql_num_rows($query);
			if ($numrows == 0)
			{
				$password = md5($password);
				$register = mysql_query ("INSERT INTO users VALUES ('', '$username', '$password, '$email', '$minecraft_username')");
				echo "you have been registerd";
			}
			else 
			echo "that username is taken";
		}
		else 
		echo "Not a valed email";
	}	
	else 
	echo "passwords dont match";
}
else
echo 'you did not fill in every feild';

}
else
?>


























Username:
Password:
Retype Password:
Email:
Minecraft Username:
 

Does the user view that page before they have submitted the form?

If so, you should check that the $_POST variable has been set. Replace:

[php]$button = $_POST[‘button’];
if ($button)
{[/php]

with

[php]if (isset($_POST[‘button’]))
{
$button = $_POST[‘button’];[/php]

And also, in future, please place your code inside of code or PHP tags. You can use the # button or the php button above the text area when creating a thread or making a reply.

ty

Sponsor our Newsletter | Privacy Policy | Terms of Service