dean.ong.14 -11 Junior Poster in Training

Notice: Undefined index: username in C:\Users\User\l\htdocs\register.php on line 12

Notice: Undefined index: password in C:\Users\User\l\htdocs\register.php on line 13

<html>
<body>

<?php
$connect=mysql_connect("localhost","root","");
$db_selected = mysql_select_db("users", $connect); 


if(isset($_POST['register'])){


$username = $_POST['username'];
$password = $_POST['password'];

    if(!$username || !$password){
    echo "One of the fields are empty";
    }else{
    $find_multiple=" SELECT username FROM resgistration WHERE Username='$username' ";
    $run_multiple = mysql_query($find_multiple) or die (mysql_error());
    $num_multiple= mysql_num_rows($run_multiple);

    if($num_multiple < 1){
    $password= md5($password);

    mysql_query( "INSERT INTO `resgistration` (`username`, `password`) VALUES ('".$username."', '".$password."')" ) or die(mysql_error());
    echo "You have succesfully registered!";

    }else{
        echo "That username has already beed used" ;
} 

     } # endelse: empty password or username
} # endif: registered
?>  
<head>
<h1>Register</h1>
<form action='' method='post'>
Username: <input type='text' name='username'/></br>
password: <input type='password' name='password'/></br>
<input type='submit' value='Register'name='register'/>

</form> 
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.