Emailing fields from MySQL database not working

the mail() function

Moderators: egami, macek, gesf

Post Reply

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".


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

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




<body bgcolor="#FFFFFF">
<table width="60%" border="0" cellspacing="5" cellpadding="0" align="center">
    <td colspan="3">
      <div align="center"></div>
    <td width="17%">
      <div align="left"><img src="../../images/GLTA-logo-new.gif" width="120" height="98"></div>
    <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 width="21%"><img src="../../images/GLTA-logo-new.gif" width="120" height="98"></td>
    <td colspan="3" height="11">&</td>

<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
    <tr bgcolor="#CCCCCC">
      <td width="224" bgcolor="#FFFFCC">
        <input type="text" name="uemail" size="30" value="Type your email address here">
      <td width="118" bgcolor="#FFFFCC">
        <input type="submit" name="Submit" value="Find Account">

<table width="40%" border="0" cellspacing="0" cellpadding="0" align="center">
      <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>

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;

Post Reply