Q:

multiple level login form not working.. while submitting

dont know why this form is not working.... while i submit this after putting username and password.. it donot show any thing after submission 
<? php 
 include "connect_to_mysql.php";
 if(isset($_POST['log']))
 {
 $user= $_POST['user'];
 $pass=md5($_POST['pass']);

   $sql=mysql_query("select* from login where user= '$user' AND pass='$pass'    LIMIT 3 ");
  $data=mysql_fetch_array($sql);

  $UserName= $data['user'];   
  $Password= $data['pass'];
  $type= $data['type'];
  $name= $data['name'];

  if($user==$username && $pass==$password){
  session_start();
  $_SESSION['name']=$name;
  if($type=='admin')
  {
         header("location: index.php");
  }
  else if($type=='vender1')
 {
         header("location: vender1.php");
  }

 }

  else {
        echo 'That information is incorrect, try again <a href="index.php">Click Here</a>';
    exit();
  }
  }
  ? >

database is created manually and login table has 5 columns named as id, name.  user, pass, type. 
     <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title> Log In </title>
   <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
   </head>

   <body>
   <br /><br /><br /><br /><br /><br /><br /><br />
   <br /><br /><br /><br />
   <div id="mainWrapper">
   <? php include_once("header.php") ? ></div>
   <div id="pageContent"><br /><br /><br />
   <div align="right" style="margin-right:24px; color:#FF0000">
   <h2>Please Log In To Manage the Inventary</h2>
   <br /><br />
   <form id="form" name="form" method="post" action="login.php">
     <h2 style="padding-right:200px;">User Name:</h2>
       <input name="user" type="text" id="user" size="40"   style="height:20px;" />
     <br /><br />
     <h2 style="padding-right:210px;">Password:</h2>
     <input name="pass" type="password" id="pass" size="40" style="height:20px;" />
    <br />
    <br />
    <br />

      <input type="submit" name="button" id="button" value="Log In" />

    </form>
   <p>&nbsp; </p>
   </div>
   <br />
   <br />
   <br />
   </div>

    </div>
     </body>
     </html>

i m stucked here.. please make me out of this

A:

Run the following code ,
    

   $sql=mysql_query("select* from login where user= '$user' AND pass='$pass'    LIMIT 3 ");
  $data=mysql_fetch_array($sql);

  $UserName= $data['user'];   
  $Password= $data['pass'];
  $type= $data['type'];
  $name= $data['name'];

  if($user==$username && $pass==$password){
  session_start();
  $_SESSION['name']=$name;
  if($type=='admin')
  {
         header("location: index.php");
  }
  else if($type=='vender1')
 {
         header("location: vender1.php");
  }

 }

  else {
        echo 'That information is incorrect, try again <a href="index.php">Click Here</a>';
    exit();
  }
  ? >

You have not used $_POST['log'] in the form ....
In your code you have used if(isset($_POST['log']))  , i have removed that because you have not using 'log' in your form.