Jump to content

[SOLVED] Undefined variable


jeff5656

Recommended Posts

This code successfully sends out an email with the $message containing everything in the WHILE loop but I get this error:

 

Notice: Undefined variable: txt in E:\wamp\www\gpu\amnotify.php on line 27

here's the code:

$query2 = "SELECT * FROM `gpu` WHERE `signoff_status` = 'a' and `service` = 'f2a' ";

$result2 = mysql_query ($query2) or die ("Invalid query: " . mysql_error ());

while ($row2 = mysql_fetch_assoc ($result2)) {
$newdate3 = date("m/d/Y", strtotime($row2['rcf_date2']));
$txt .= $row2['patient'] . " (" . $row2['mrn'] . ") " . $newdate3 ." Dx: " . $row2['dx']. "\n<br>";
}

$message = "Good morning Dr.  " . $whoto . ",<br>" . "This is the census for F2a:<br>" . $txt;
$subject = "Notification of GPU admission";
$headers = "From: [email protected]";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$sent = mail($to, $subject, $message, $headers);

Link to comment
https://forums.phpfreaks.com/topic/162657-solved-undefined-variable/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.