Help me in Register forum

Help me in Register forum

I write this program but this error appear

Notice: Undefined index: Submit in C:\wamp\www\accounting website\register.php on line 40

[COLOR=“Red”]Notice: Undefined index: FullName in C:\wamp\www\accounting website\register.php on line 43

Notice: Undefined index: email in C:\wamp\www\accounting website\register.php on line 45

Notice: Undefined index: username in C:\wamp\www\accounting website\register.php on line 46

Notice: Undefined index: password in C:\wamp\www\accounting website\register.php on line 47

Notice: Undefined index: repeatpassword in C:\wamp\www\accounting website\register.php on line 48[/COLOR]

<?php
echo "<h1>Register</h1>";
 
$submit = $_POST['Submit'];

//from data
$fullname = strip_tags($_POST['FullName']);

$email = strip_tags($_POST['email']);
$username = strtolower(strip_tags($_POST['username']));
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);

if ($submit)
{
       //open database
	$connect = mysql_connect('localhost','root','') ;
	mysql_select_db("phplogin") ;

	$namecheck = mysql_query("SELECT username FROM user WHERE username='$username' ");	   
	$count = mysql_num_rows($namecheck);
	
	if($count !=0)
	{
	die ("Username already taken!");
	}

	//check for existance
	if($fullname&&$email&&$username&&$password&&$repeatpassword)
	{

	 
	    if ($password==$repeatpassword)
	    {

		//check char length of username and fullname	    
		  if (strlen($username)>25 || strlen($fullname)>25)
		  {
		    echo "Max limit for user/fullname are 25 characters";
		  } 
		  else
		  {
		    //check password length
		    if (strlen($password)>25 || strlen($password)<6)
		     {
		    echo "Password must be betwen 6 and 25 characters";
		    }
		    else
	 	    {
		     //register the user!

		    //encrypt password
	           $password = md5($password);
	           $repeatpassword = md5($repeatpassword);

		   
			
		   $queryreg = mysql_query("

		   INSERT INTO user VALUES ('','$fullname','$email','$username','$password')");

			die ("You have been registered! <a href='index.php'>Return to login page</a>");
		     
		    }
		  }
	    }
    	    else
		echo "Your passwords do not match!";

		  	 	

	 }
	else 
	echo "Please fill in <b>all</b> filds!<p>";
}



?>
<p></p>
<table align=center>
<tr><td>
<form action='register.php' method = 'post'>
	<table>
		<tr>
		    <td> 
		    Your full name:
		    </td>
		    <td>
		    <input type='text' name='FullName' >
		    </td>
		</tr>
		<tr>
		    <td> 
		    Your email:
		    </td>
		    <td>
		    <input type='text' name='email'>
		    </td>
		</tr>
		<tr>
		    <td> 
		    Choose a username:
		    </td>
		    <td>
		    <input type='text' name='username'>
		    </td>
		</tr>
		<tr>
		    <td> 
		    Chose a password:
		    </td>
		    <td>
		    <input type='password' name='password'>
		    </td>
		</tr>
		<tr>
		    <td> 
		    Repeat your password:
		    </td>
		    <td>
		    <input type='password' name='repeatpassword'>
		    </td>
		</tr>
	</table>
<p><input type='submit' name='Submit' value='Register'></p>
</form></td>
</tr>
</table>

Change the beginning of your code to:


<?php
echo "<h1>Register</h1>";
 
$submit = 'POST' === $_SERVER['REQUEST_METHOD'];

if ($submit)
{
  //from data
  $fullname = strip_tags($_POST['FullName']);
  
  $email = strip_tags($_POST['email']);
  $username = strtolower(strip_tags($_POST['username']));
  $password = strip_tags($_POST['password']);
  $repeatpassword = strip_tags($_POST['repeatpassword']);
  
  //open database

what mean it $_SERVER[‘REQUEST_METHOD’]

It’s an array key of $_SERVER superglobal that tells you what request method was used.

can not understand it

Here, this may help. :slight_smile: