Hello and thanks in advance to anyone that can help. I trying a simple password recovery script that emails the password after a registered user enters their email. For testing purposes I have been able to get the variable to display on the page after submission, but the email that is sent is missing them.
*note that I have a function called getvar that retreives the variables
<?php
include 'common/useful_stuff.php'; //db connection script
if (!db_connect())
die();
$errmsg = "";
$teamname =getvar("teamname");
$teampassword=getvar("teampassword")
$mailmssg ="Your password is" . $teamname . $teampassword; //<--these are the //variables I am trying to get displayed in the sent email.
$email = getvar("email");
$doit = getvar("doit");
if ($doit == "yes"){
if ( $email == ""){
$errmsg = "You must enter an email address!";
}
else {
// go see if they are in the db
$em = mysql_real_escape_string($email);
$res = mysql_query("select team_ID,teamname,teampassword from teams where teamemail='{$email}'");
$row = mysql_fetch_assoc($res);
if (!$row){
$errmsg = "No account with that email address!";
}
else {
mail("$em", "Lost Password",$mailmssg,"FROM:$em");
echo"
<p>Your username and password have been sent to {$em} for {$row['teamname']} The Password is: {$row['teampassword']}.<br> Once you have received your password you may <a href='teamlogin.php'>log in</a>.</p>";
}
}
}
?>
<html>
<head>
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
include 'common/header.php';
echo "
<div id='content'>
<h1>Team Log-In</h1>
<p><font color='red'><b>{$errmsg} </b></font></p>
<p>Please enter the email account your team registered with.</p>
<p> </p>
<p><form action='{$_SERVER['PHP_SELF']}' method='post'>
<input type='hidden' name='doit' value='yes'>
email<br><input type='text' name='email' value='{$email}'>
<br><input type='submit' value='Retrieve Password'>
</form>
</div>
";
?>
</body>
</html>
to summarize. The email is sent correctly it just doesn't contain the necessary variables.
thanks in advance!