如何为此要求编写忘记密码


How to write forget password for this requirement

我有三个表:tutorregistration、studentregistration和Instituteregistration。现在我想为此写忘记密码代码:我知道如何为此发送邮件,指导我的逻辑方法是正确的。如果是错误的,请给我一个正确的代码。

<form name="f1" action="" method="post">
<strong>Email</strong>
<input type="text" name="email" value="" class="buttonlength"/>
<strong>Password</strong>
<input type="password" name="password" value="" class="buttonlength"/>
<input type="radio" name="type" value="student" />Student <input type="radio" name="type" value="tutor" />Tutor <input type="radio" name="type" value="institute" />Institute</td>
<input type="submit" name="Submit" value="Submit" class="btn" id="submit"/>
</form>

      In forget.php file:
        <form name="f1" action="" method="post">
        enter email:<input type="text" name="email" value=''/>
                     <input type="submit" name="Submit"/>
        </form>
    if(isset($_POST['Submit']))
    {
    $email = $_POST['email'];
    $sqlstudent=mysql_query("SELECT * FROM  studentregistration WHERE  email='".$email."'") or die(mysql_error());
     $row_rsinfo=mysql_fetch_assoc($sqlstudent))
    $sqltutor=mysql_query("SELECT * FROM  tutorregistration WHERE  email='".$email."'") or die(mysql_error());
  $row_rsinfo=mysql_fetch_assoc($sqltutor))
    $sqlinstitute=mysql_query("SELECT * FROM  Instituteregistration WHERE  email='".$email."'") or die(mysql_error());
    $row_rsinfo=mysql_fetch_assoc($sqlinstitute))
    if(count($row_rsinfo)>=1)
    {
    //mail work here
    }
    }
    ?>
So far what  I have tried.I have given,I know how to send mail for registered mail id.Here I want to know how to check which query is executing, check and give me the answer for this.

您应该为忘记的密码执行此操作。

输入电子邮件:
 <?php
        if(isset($_POST['Submit']))
        {
        $email = $_POST['email'];
        $sqlstudent=mysql_query("SELECT * FROM  studentregistration WHERE  email='".$email."'") or die(mysql_error());
         $row_rsinfo=mysql_fetch_assoc($sqlstudent));
  if(count($row_rsinfo)==1)
        {
        //mail work here
        }
        $sqltutor=mysql_query("SELECT * FROM  tutorregistration WHERE  email='".$email."'") or die(mysql_error());
      $row_rsinfo=mysql_fetch_assoc($sqltutor));
    if(count($row_rsinfo)==1)
        {
        //mail work here
        }
        $sqlinstitute=mysql_query("SELECT * FROM  Instituteregistration WHERE  email='".$email."'") or die(mysql_error());
        $row_rsinfo=mysql_fetch_assoc($sqlinstitute))
        if(count($row_rsinfo)==1)
        {
        //mail work here
        }
        }
        ?>