enter key clears form
Posted: Wed Jul 10, 2002 9:15 am
I have a simple forgotten password page, the problem is when the user hits return the script is executed but the form is just cleared.
When the user clicks on the actual submit button rather than hitting enter, the form works fine. Any fixes for this?
that's my code.
When the user clicks on the actual submit button rather than hitting enter, the form works fine. Any fixes for this?
Code: Select all
<?php
if(!IsSet($submit)) {
?>
<div align="center">
<h3 align="left">If you have forgotten your password and/or username:</h3>
<table width="68%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><li>Enter your email in the form below</li>
</td>
</tr>
<tr>
<td><li>Check your email to recover your username/password</li>
</td>
</tr>
<tr>
<td><li>Proceed to the <a href="http://www.pancorp.com/techs/index.php">Login
Page</a> and enter your username/password combination</li>
</td>
</tr>
</table>
<br>
<br>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></div>
<form action="<?=$PHP_SELF?>" method="post" name="forgetPW" id="forgetPW">
<table width="250" border="0" align="center" cellpadding="0" cellspacing="6">
<tr>
<td width="32%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email:</font></td>
<td width="68%"><input name="email" type="text" id="email"></td>
<td width="68%"><input type="submit" name="submit" value="Submit"></td>
</tr>
</table>
<br>
</form>
<?php
}
else {
include("webvars.php");
mysql_connect($hostname, $user, $pass)
or die ("the site database is down.");
mysql_select_db("pancorp");
//connect to db
$sql = "SELECT * FROM technicians WHERE email = '$email'";
$result = mysql_query($sql) or die(mysql_error());
$info = mysql_fetch_array($result);
$firstname = $infoї'firstname'];
$username = $infoї'username'];
$password = $infoї'password'];
//fetch info pertaining to email in an array
$address = ($email);
$body = "$firstname:
Your username and password are as follows:
Username: $username
Password: $password
To login to your account proceed to http://techs.pancorp.com
Sincerely,
Pancorp.com Team";
mail($address, "Pancorp.com Password Retrieval", $body, "From: Pancorp.com Username/Password <pancorp@pancorp.com>");
//email information
?>
your password has been emailed
<?php
}
?>