I have got some script from the internet to allow the customer to reset their password if they need to but I can't seem to get it work.
This is how I have implemented it:
<?php 
    error_reporting(0);
    $EmailAddress=$_POST['EmailAddress'];
    if($_POST['submit']=='Send')
    {
        require "db.inc";
        $query="SELECT * from members WHERE EmailAddress='$EmailAddress'";
        $result=mysql_query($query) or die(error);
        if(mysql_num_rows($result))
        {
            echo "User exist";
        }
        else
        {
            echo "No user exist with this email id1";
        }
    }
    if(mysql_num_rows($result))
    {
        $code=rand(100,999);
        $message="You activation link is: http://yourwebsitename.com/forgot.php?    EmailAddress=$EmailAddress&code=$code";
        mail($EmailAddress, "Subject Goes Here", $message);
        echo "Email sent";
    }
    else
    {
        echo "No user exist with this email id2";
    }
?>
And this is the form that redirects to this page
<form method="POST" action="EmailPassword.php">
    <div class="Row">
        <div class="Lable">Email Address:</div> <!--End of Lable-->
        <div class="input">
            <input type="email" id="EmailAddress" class="detail" name="EmailAddress" placeholder="Email Address" required />
        </div> <!--End input-->
    </div> <!--End row-->
    <br />
    <div class="submit">
        <input type="submit" id="Reset" Name="submit" value="Send Password" /> 
    </div><!--End of .submit-->
</form>
The error I'm getting is
No user exists with this email id2.
 
     
    