I need to send an email after an insert record
I have a page that users register on. They are taken immediately to a page that display's their information that they just entered (the seond page pulls their information from a query with a session variable as the filter. My question is how do I send the admin an email that contains all of the user's information? I've tried adapting my mail scripts that I have used to make contact forms, but none seem to work. My guess is that I have things placed wrong. Below is the page:
<?php session_start(); ?>
<?php require_once('../../Connections/connDB.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_rsDisplay = "-1";
if (isset($_SESSION['Username'])) {
$colname_rsDisplay = (get_magic_quotes_gpc()) ? $_SESSION['Username'] : addslashes($_SESSION['Username']);
}
mysql_select_db($database_connDB, $connDB);
$query_rsDisplay = sprintf("SELECT ID, Email_Address, First_Name, Middle_Name, Last_Name, Date_of_Birth, Phone_Number, Travel_Type, Airport_Depart, Airport_Return, Train_Depart, Train_Return, Additional_Comments FROM Travel WHERE Email_Address = %s", GetSQLValueString($colname_rsDisplay, "text"));
$rsDisplay = mysql_query($query_rsDisplay, $connDB) or die(mysql_error());
$row_rsDisplay = mysql_fetch_assoc($rsDisplay);
$totalRows_rsDisplay = mysql_num_rows($rsDisplay);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>TRIO Student Support Services</title>
<link rel=stylesheet type="text/css" href="../style.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 11pt;
}
.style3 {
font-size: 22pt;
font-weight: bold;
}
.style4 {
font-size: 12pt;
font-weight: bold;
}
.style5 {color: #FF0000}
</style>
</head>
<body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" background="../img/background.jpg">
<table height="123" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td><img src="../img/blanklogo.jpg" width="574" height="123" border="0" alt=""></td>
<td width="100%" valign="middle" background="../img/topbg.jpg"><span class="style3">Student Support Services</span><br>
<span class="style4">Office of Federal TRIO Programs</span></td>
</tr>
</table>
<table height="40" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="100%" background="../img/topbar.jpg"> </td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td width="201"><BR>
<a href="../index.php">HOME</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
<a href="../readerresources.php">READER RESOURCES</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
TRAVEL REGISTRATION<BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
<a href="../contactus.php">CONTACT US</a><BR>
<img src="../img/menubar.jpg" width="201" height="11" border="0" alt=""><BR>
</td>
<td width="100%">
<table width="90%" border="0" align="center" cellpadding="10" cellspacing="0">
<tr valign="top">
<td>
<br>
Thank you for registering your travel information. Our travel agent will be in touch with you shortly. The information
you submitted is displayed below. Please verify it. Should you need to make any changes, please click <a href="login.php">here</a> to log in
and update your information.<br>
<br>
<table width="90%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="44%"><div align="right">First Name:</div></td>
<td width="56%"><span class="style5"><?php echo $row_rsDisplay['First_Name']; ?></span></td>
</tr>
<tr>
<td><div align="right">Middle Name:</div></td>
<td><span class="style5"><?php echo $row_rsDisplay['Middle_Name']; ?></span></td>
</tr>
<tr>
<td><div align="right">Last Name:</div></td>
<td><span class="style5"><?php echo $row_rsDisplay['Last_Name']; ?></span></td>
</tr>
<tr>
<td><div align="right">Date of Birth:</div></td>
<td><span class="style5"><?php echo $row_rsDisplay['Date_of_Birth']; ?></span></td>
</tr>
<tr>
<td><div align="right">Phone Number:</div></td>
<td><span class="style5"><?php echo $row_rsDisplay['Phone_Number']; ?></span></td>
</tr>
<tr>
<td><div align="right">Method of Travel:</div></td>
<td><span class="style5"><?php echo $row_rsDisplay['Travel_Type']; ?></span></td>
</tr>
<?php if ($row_rsDisplay['Travel_Type'] == "Flying") { ?>
<?php echo
"<tr>
<td><div align="right">Airport Departing From:</div></td>
<td><span class="style5">echo $row_rsDisplay['Airport_Depart'];</span></td>
</tr>
<tr>
<td><div align="right">Airport Returning To:</div></td>
<td><span class="style5">echo $row_rsDisplay['Airport_Return'];</span></td>
</tr>"; ?>
<?php } ?>
<tr>
<td><div align="right">Train Station Departing From:</div></td>
<td><span class="style5"><?php echo $row_rsDisplay['Train_Depart']; ?></span></td>
</tr>
<tr>
<td><div align="right">Train Station Returning To:</div></td>
<td><span class="style5"><?php echo $row_rsDisplay['Train_Return']; ?></span></td>
</tr>
<tr>
<td><div align="right">Additional Comments or Accomodations:</div></td>
<td><span class="style5"><?php echo $row_rsDisplay['Additional_Comments']; ?></span></td>
</tr>
</table>
<br>
<br>
<br>
<br></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rsDisplay);
?>
Please help me out. Thanks in advance!