Hi,
I have followed this tutorial http://www.phpeasystep.com/phptu/21.html but it doesn't appear to be working properly.
Here is my code for the form
<td width="33%"><strong>Enter your email : </strong></td>
<td width="67%"><form name="form1" method="post" action="send_password_ac.php">
<input name="email_to" type="text" id="mail_to" size="25">
<input type="submit" name="Submit" value="Submit">
</form>
</td>
Here is my send_password_ac.php
<?php
include("Connections/conn.php");
//value sent from form
$email_to=$_POST['email_to'];
//retrieve password from table where email =$email_to
$sql="SELECT password FROM member WHERE email='$email_to'";
$result=mysql_query($sql);
//if found this email address, row must be 1 row
//keep value in variable name "$count"
$count=mysql_num_rows($result);
//compare if $count=1 row
if($count==1){
$rows=mysql_fetch_array($result);
//keep password in $your_password
$your_password=$rows['password'];
//_______send mail form___________
//send email to
$to=$email_to;
//Your subject
$subject="AboriginalNRM Skills database password";
//From
$header="from:David New <new.david@saugov.sa.gov.au>";
//Your message
$messages= "Your password for login to the AboriginalNRM skills website is \r\n";
$messages.="$your_password \r\n";
$messages.="To login visit http://www.aboriginalnrm.com.au/individual.php \r\n";
//send email
$sentmail = mail("$to,$subject,$messages,$header");
}
// else if $count not equal 1
else {
echo "Your email is not found in our database. ";
}
//if your email successfully sent
if($sentmail){
echo "Your password has been sent to your email address.";
}
else{
echo "Cannot send password to your email address";
}
?>
It is saying "Your email is not found in our database. Cannot send password to your email address". But my email address is definately there.