(At the moment I’m just returning this to the browser to keep things simple for testing).
I can manage to get various results but no matter what I try none are satisfactory. There are 3 main things that I need to do. Firstly if the form is left blank it need to have an error showing that there is no match in the database and similarly if an email address is not found I need the same message displayed. Thirdly I then need to return the correct password if the email and password match.
I know the logic but can’t seem to figure it out in the script.
I have tried a few methods such as:
Attempt 1
Code: Select all
<?php //if (!empty($_GETї'username']))
$username = $_GETї'username'];
if ($username == 0) {
echo $row_rstGetLostEmailї'password'];
}
else {
echo 'get out of here';
}Code: Select all
if (!empty($_POSTї'username'])){
echo 'sorry there is no match';
}
else {
echo $row_rstGetLostEmailї'password'];
}If anyone can help I’d be very grateful as I thought that this should be easy to do but that was my first mistake!
Thanks a mil
Code: Select all
<?php require_once('Connections/b.php'); ?>
<?php
$colname_rstGetLostEmail = "1";
if (isset($_GETї'username'])) {
$colname_rstGetLostEmail = (get_magic_quotes_gpc()) ? $_GETї'username'] : addslashes($_GETї'username']);
}
mysql_select_db($database_brian, $brian);
$query_rstGetLostEmail = sprintf("SELECT * FROM users WHERE username = '%s'", $colname_rstGetLostEmail);
$rstGetLostEmail = mysql_query($query_rstGetLostEmail, $brian) or die(mysql_error());
$row_rstGetLostEmail = mysql_fetch_assoc($rstGetLostEmail);
$totalRows_rstGetLostEmail = mysql_num_rows($rstGetLostEmail);
?>
<body>
<?php //if (!empty($_GETї'username']))
if (empty($_POSTї'username'])) {
echo $row_rstGetLostEmailї'password'];
}
else {
echo 'sorry there is no match';
}
?>
<form name="form1" method="$_POSTї'username']" action="<?php $_SERVERї'PHP_SELF']?>">
<input type="text" name= "username">
<input type="submit" value="Search For Password">
Retrieve Lost Password
</form>
</body>
<?php
mysql_free_result($rstGetLostEmail);
?>