I am trying to give my users the ability to retrieve their forgotten password via Email through my web site. All that happens with my current form is that the page refreshes and the HTML for that was there dissapears.
<?php
if(isset($_POST['remind_me']))
{
$sql = "SELECT password,email FROM users WHERE username='$username'";
$query = mysql_query($sql);
$email = mysql_result($sql,0,'email');
$passwd = mysql_result($sql,0,'password');
mail("$thisEmail", "Information you requested.", "Your passwd is '$passwd'", "From: [email]webmaster@nasser.net\n");
}
?>
Then my HTML for the form is as follows:
<form action="<?=$HTTP_SERVER_VARS['PHP_SELF']?>" method="post">
<table width="590" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/spacer.gif" width="250" height="15"></td>
</tr>
<tr>
<td>Complete this form and your password will be sent to the Email address you used when you signed up.</td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="250" height="15"></td>
</tr>
<tr>
<td>Username:</td>
</tr>
<tr>
<td>
<input type="text" name="username" maxlength="20" size="30">
</td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="250" height="10"></td>
</tr>
<tr>
<td>
<input type="hidden" name="remind_me" value="1">
<input type="image" value="Submit" border="0" src="images/button_remind.gif" width="93" height="24">
</td>
</tr>
</table>
<br>
</form>
Then the closing PHP after the form tag:
<?php
}
?>
The entire code can be viewed by viewing the source code at the following like: VIEW THIS SOURCE CODE
the PHP code that connects to my database is in the header.php file.