resolved, moved a few things around..
still messy i guess but heres the finished code if anyones interested 🙂
// looks up database for email address
if ($recover == "entered")
{
$sql = "select * from clientdb where email = '$email'";
$result = (mysql_query($sql))
or die(mysql_error());
$num_rows = mysql_num_rows($result);
if ($num_rows <= 0)
{
Print("Sorry, the email address entered was not found in the database");
}
Else
{
$sql = "select * from Control where email = '$email'";
$result = (mysql_query($sql))
or die(mysql_error());
$num_rows = mysql_num_rows($result);
while($row=mysql_fetch_array($result))
{
$user = $row['login'];
$pass = $row['rawpass'];
$sendto = $_REQUEST['email'];
$subject = "On Stage Shirts Login Information";
$from = "Support@onstageshirts.com.au";
$message = "Here is your onstageshirts.com.au login information<br><br>Username : ".$user."<br>Password : ".$pass;
$headers = "From: onstageshirts.com.au <Support@onstageshirts.com.au>\r\n"."Content-Type: text/html";
mail($sendto, $subject, $message, $headers);
Print("An Email containing your username and password has been sent to ".$_REQUEST['email']);
}
}
}
print("<pre>");
print_r($_REQUEST);
print("</pre>");
?>
<form name="recover" action="recover.php" method="post">
<table>
<tr>
<td>Enter Your Email Address :</td>
<td><input type="text" name="email" value="<?=$email?>"></td>
</tr>
<td colspan="2" align="center">
<input type="submit" value="Recover Password">
<input type="hidden" name="recover" value="entered">
</td>
</table>
</form>