<?php
$fullname=strip_tags($_POST['fullname']);
$username=strip_tags($_POST['username']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date=date("Y-m-d");
$submit=$_POST['submit'];
?>
<html>
<h1>REGISTER !</h1>
<form action='register.php' method='POST'>
<table border =25 color=black align=center space=5 >
      <tr>
           <td>Full Name:</td>
           <td><input type='text' name='fullname' value='<?php echo $fullname; ?>'></td>
      </tr>
      <tr>
          <td>User Name  :</td>
          <td><input type='text' name='username' value='<?php echo $username; ?>'></td>
      </tr>
      <tr>
          <td>Password :</td>
          <td><input type='password' name='password'></td>
      </tr>
       <tr>
           <td>Confirm Password:</td>
           <td><input type='password' name='repeatpassword'></td>
      </tr>
      <td><input type='submit' value='Register !'</td>
</table>
</form>
</html>
<?php
$fullname=strip_tags($_POST['fullname']);
$username=strip_tags($_POST['username']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date=date("Y-m-d");
if($submit)
   {
           //check for existance
           if($fullname&&$username&&$password&&$repeatpassword)
           {
           //encrypt password
                     $password=md5($password);
                     $repeatpassword=md5($repeatpassword);
                     if($password==$repeatpassword)
                      {
                       echo"Password dont match";
                       }
                     elseif(strlen($password)>25||strlen($password)<6)
                         {
                         echo"Password must be between 6 and 25 characters";
                         }
                     elseif(strlen($username)<20||strlen($fullname)>25)
                         {
                          echo"Username or fullname is too long";
                         }
           }
           else
           {
           echo"fill all fields";
           }
   }
   else
   echo"Registered Successfully";
   $connect =  mysql_connect("localhost","root","");
   mysql_select_db("phplogin");//select database
         $query=mysql_query ("
         INSERT INTO users VALUES('','$fullname','$username','$password','$date')
         ");
         die("you have been registered !<a href='index.php'>click</a>here to log in");


?>

A couple of things:

  1. Your are using the variable $password but I can't see anywhere above that code that actuallys assigns a value to that variable.
  2. You are assigning your query to a variable but not actually running the query anywhere, you don't need a blank space for the id and you should indicate the columns you are inserting into. Try your query as

    mysql_select_db("phplogin");//select database
    mysql_query ("
    INSERT INTO users (fullname, username, password, date) VALUES('$fullname','$username','$password','$date')
    ");

ALso, remove the die - that should be used for database erors only.

thanks for help but i did this as i was not using same varriable which i was posting now i did it thanks man

Be a part of the DaniWeb community

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