hightechredneck
01-10-2007, 10:36 PM
This is a new one, I'm getting an undefined index on a send mail function:
Notice: Undefined index: id in /.../.../resolution.php on line 91
Here's the bulk of the code:
<?php # PHP Script - submit debtors resolution.php
// This displays debtors info.
$query = "SELECT id, business_name, responsible_party, address, city, state, zip, dollar_amount, resolved, date_resolved, paid FROM debtors WHERE id = {$_SESSION['id']}";
$result = mysql_query ($query) or die (mysql_error());
if ($result) {
echo '<table border="2" width="100%" cellspacing="3" cellpadding="3" align="center">
<tr>
<td><font face="arial" size="2"><b>Business Name</b></font></td>
<td><font face="arial" size="2"><b>Responsible Party:</b></font></td>
<td><font face="arial" size="2"><b>Address:</b></font></td>
<td><font face="arial" size="2"><b>Amount Owed:</b></font></td>
</tr>';
// Display all the URLs.
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
// Display each record.
echo '<tr>
<td align="left" valign="top"><font face="arial" size="2" color="#FF0000"><b>' . $row[1] . '</b></font></td>
<td align="left" valign="top"><font face="arial" size="2" color="#FF0000"><b>' . $row[2] . '</b></font></td>
<td align="left" valign="top"><font face="arial" size="2">' . $row[3] . '<br>' . $row[4] . ', ' . $row[5] . ' '. $row[6] . '</font></td>
<td align="left" valign="top"><font face="arial" size="2">' . $row[7] . '</font></td>
</tr>';
echo '</table>';
}
}
}
if (isset($_POST['Submit'])) { // Handle the form.
$query = "SELECT id, business_name, responsible_party, address, city, state, zip, dollar_amount, resolved, date_resolved, paid FROM debtors WHERE id = {$_SESSION['id']}";
$result = mysql_query ($query);
// Check for resolved status
if (!empty($_POST['resolved'])){
$r = escape_data($_POST['resolved']);
} else {
$r = FALSE;
echo '<p><font color="red">Please update resolved status!</font></p>';
}
// Check for date resolved
if (!empty($_POST['date_resolved'])){
$dr = escape_data($_POST['date_resolved']);
} else {
$dr = FALSE;
echo '<p><font color="red">Please enter the date this debt was resolved!</font></p>';
}
if ('$r' && '$dr') {
$query = "UPDATE debtors SET resolved ='$r', date_resolved = '$dr', paid = 'No' WHERE id = {$_SESSION['id']}";
$result = mysql_query ($query) or die (mysql_error()); // Run the query.
if ($result) { // If it ran OK.
// Send an email, if desired.
$body = "A debt resolution has just been submitted for Debtor ID '{$_POST['id']}'.";
mail('sales@professionaldebtor.com', 'Debt Resolution', $body, 'From: sales@professionaldebtor.com');
echo '<h3>Your debtor resolution has been posted.</h3>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
exit();
} else { // If it did not run OK.
// Send a message to the error log, if desired.
echo '<p><font color="red" size="+1">Your debtor information could not be updated due to a system error.</font></p>';
}
}
mysql_close(); // Close the database connection.
} // End of the main Submit conditional.
?>
Line 91 is:
$body = "A debt resolution has just been submitted for Debtor ID '{$_POST['id']}'.";
What would cause this?
Thanks
T
Notice: Undefined index: id in /.../.../resolution.php on line 91
Here's the bulk of the code:
<?php # PHP Script - submit debtors resolution.php
// This displays debtors info.
$query = "SELECT id, business_name, responsible_party, address, city, state, zip, dollar_amount, resolved, date_resolved, paid FROM debtors WHERE id = {$_SESSION['id']}";
$result = mysql_query ($query) or die (mysql_error());
if ($result) {
echo '<table border="2" width="100%" cellspacing="3" cellpadding="3" align="center">
<tr>
<td><font face="arial" size="2"><b>Business Name</b></font></td>
<td><font face="arial" size="2"><b>Responsible Party:</b></font></td>
<td><font face="arial" size="2"><b>Address:</b></font></td>
<td><font face="arial" size="2"><b>Amount Owed:</b></font></td>
</tr>';
// Display all the URLs.
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
// Display each record.
echo '<tr>
<td align="left" valign="top"><font face="arial" size="2" color="#FF0000"><b>' . $row[1] . '</b></font></td>
<td align="left" valign="top"><font face="arial" size="2" color="#FF0000"><b>' . $row[2] . '</b></font></td>
<td align="left" valign="top"><font face="arial" size="2">' . $row[3] . '<br>' . $row[4] . ', ' . $row[5] . ' '. $row[6] . '</font></td>
<td align="left" valign="top"><font face="arial" size="2">' . $row[7] . '</font></td>
</tr>';
echo '</table>';
}
}
}
if (isset($_POST['Submit'])) { // Handle the form.
$query = "SELECT id, business_name, responsible_party, address, city, state, zip, dollar_amount, resolved, date_resolved, paid FROM debtors WHERE id = {$_SESSION['id']}";
$result = mysql_query ($query);
// Check for resolved status
if (!empty($_POST['resolved'])){
$r = escape_data($_POST['resolved']);
} else {
$r = FALSE;
echo '<p><font color="red">Please update resolved status!</font></p>';
}
// Check for date resolved
if (!empty($_POST['date_resolved'])){
$dr = escape_data($_POST['date_resolved']);
} else {
$dr = FALSE;
echo '<p><font color="red">Please enter the date this debt was resolved!</font></p>';
}
if ('$r' && '$dr') {
$query = "UPDATE debtors SET resolved ='$r', date_resolved = '$dr', paid = 'No' WHERE id = {$_SESSION['id']}";
$result = mysql_query ($query) or die (mysql_error()); // Run the query.
if ($result) { // If it ran OK.
// Send an email, if desired.
$body = "A debt resolution has just been submitted for Debtor ID '{$_POST['id']}'.";
mail('sales@professionaldebtor.com', 'Debt Resolution', $body, 'From: sales@professionaldebtor.com');
echo '<h3>Your debtor resolution has been posted.</h3>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
echo '<br/>';
exit();
} else { // If it did not run OK.
// Send a message to the error log, if desired.
echo '<p><font color="red" size="+1">Your debtor information could not be updated due to a system error.</font></p>';
}
}
mysql_close(); // Close the database connection.
} // End of the main Submit conditional.
?>
Line 91 is:
$body = "A debt resolution has just been submitted for Debtor ID '{$_POST['id']}'.";
What would cause this?
Thanks
T