Emailing fields from MySQL database not working

the mail() function

Moderators: macek, egami, gesf

dmyers
New php-forum User
New php-forum User
Posts: 5
Joined: Tue Jun 24, 2003 11:55 am

Emailing fields from MySQL database not working

Postby dmyers » Wed Jun 25, 2003 7:47 pm

Ok, I have this form I created that queries a DB after a user enters their email address and clicks "Find Account".

Image

The query works fine and I can echo all of the fields I want to email onto the screen, but I can not seem to get anything to work as far as emailing those fields go.

Normally I don't just ask someone to do something for me, but I am on a serious time line, that I have to meet. If anyone could be of help I would be eternally grateful.

Code: Select all


<html>
<head>
<title>Find Password</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style>
td{
font-family:arial;
font-size:8pt;
color:#696969;
}
.wh{
color:white;
}
.more{
color:#0974A6;
}
.menu{
color:#748B3D;

}
</style>

</head>

<body bgcolor="#FFFFFF">
<table width="60%" border="0" cellspacing="5" cellpadding="0" align="center">
  <tr>
    <td colspan="3">
      <div align="center"></div>
    </td>
  </tr>
  <tr>
    <td width="17%">
      <div align="left"><img src="../../images/GLTA-logo-new.gif" width="120" height="98"></div>
    </td>
    <td width="62%">
      <div align="center"><b><font color="#000000">Please note that if you have
        not set up your Password Retrieval Profile, which includes providing your
        e-mail address, you will not be able to use this feature.</font></b></div>
    </td>
    <td width="21%"><img src="../../images/GLTA-logo-new.gif" width="120" height="98"></td>
  </tr>
  <tr>
    <td colspan="3" height="11">&</td>
  </tr>
</table>

<form name="form1" method="POST" action="<?=$PHP_SELF?>" >
  <table width="342" border="1" cellspacing="3" cellpadding="3" bordercolor="#333333" align="center">
    <tr align="center" bgcolor="A5E2FF">
      <td colspan="2"><font face="Tahoma"><b><font color="#FF0000">Retrieve Account
        Information</font></b></font></td>
  </tr>
    <tr bgcolor="#CCCCCC">
      <td width="224" bgcolor="#FFFFCC">
        <input type="text" name="uemail" size="30" value="Type your email address here">
      </td>
       
      <td width="118" bgcolor="#FFFFCC">
        <input type="submit" name="Submit" value="Find Account">
      </td>
  </tr>
</table>
</form>

<table width="40%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <div align="center"><b><font color="#000000">Click <a href="../login.php" target="_self">here</a>
        to go back to the login screen.</font></b> </div>
    </td>
  </tr>
</table>


<?
if ( isset ( $_POST ["uemail"] ) ) {
@mysql_connect('*****', '*****', '*****') or die(mysql_error());
@$result = mysql_list_tables('*****') or die(mysql_error());

$sql = "SELECT * FROM authuser WHERE email = '{$_POST['uemail']}'";
@$result = mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');

while ($row = mysql_fetch_row($result)) {
//  $tb_names[] = $row[0];
//  echo "System ID: ";
//  echo $row[0].'<br />';
   echo "First Name: ";
   echo $row[8].'<br />';
   echo "Last Name: ";
   echo $row[9].'<br />';
   echo "User Group: ";
   echo $row[3].'<br />';
   echo "Status: ";
   echo $row[5].'<br />';
   echo "Username: ";
   echo $row[1].'<br />';
   echo "Password: ";
   echo $row[11].'<br />';
//  echo "Encrypted Password: ";
//   echo $row[2].'<br />';
//   echo "Level: ";
//   echo $row[4].'<br />';
//   echo "Last Logon: ";
//   echo $row[6].'<br />';
//   echo "Logon Count: ";
//   echo $row[7].'<br />';
   echo "E-Mail Address: ";
   echo $row[10].'<br />';
}
   $username = $row[1];
   $firstname = $row[8];
   $lastname = $row[9];
   $password = $row[11];
   $email = $row[10];
   $group = $row[3];
   $status = $row[5];
   $uemail = $row[10];
//    $subject = "Message from GLTA security";
   $message = $password;
}
?>
</body>
</html>


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest