Using Dreamweaver and recordsets with some PHP--I've tried alot of ways to get this to work:
1. Form info is submitted to DB, then goes to thank you page
2. on thank you page I place code to send email back to person with several of the form varibles in the message.
PROBLEM: the varibles are always blank and the email doesn't go to them (one of the missing variable is their email address).
Below I have the form coming to me for testing purposes:
The FORM Page:
<?
// build the form action
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'] . (isset($HTTP_SERVER_VARS['QUERY_STRING']) ? "?" . $HTTP_SERVER_VARS['QUERY_STRING'] : "");
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO class_register (first_name, email) VALUES (%s, %s)",
GetSQLValueString($HTTP_POST_VARS['first_name'], "text"),
GetSQLValueString($HTTP_POST_VARS['email'], "text"));
$Result1 = $conn_schedules->Execute($insertSQL) or die($conn_schedules->ErrorMsg());
$insertGoTo = "testmail.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
KT_redir($insertGoTo);
}
// begin Recordset
$query_Recordset1 = "SELECT * FROM class_register";
$Recordset1 = $conn_schedules->SelectLimit($query_Recordset1) or die($conn_schedules->ErrorMsg());
$totalRows_Recordset1 = $Recordset1->RecordCount();
// end Recordset
//PHP ADODB document - made with PHAkt 2.6.2
?>
<form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
first name
<input name="first_name" type="text" id="first_name" />
email
<input type="text" name="email" />
<input type="submit" value="Submit" />
<input type="hidden" name="MM_insert" value="form1">
</form>
<?php
$Recordset1->Close();
?>
The THANK YOU Page:
<?php
echo "<html><body>";
// This is where we get the variables passed from the form.
$name = $REQUEST['first_name'];
$email = $REQUEST['email'];
$recipient = "myemail@testing.com";
$subject = "Submit Form Test";
$message = "first_name " . $name . " email " . $email;
$extra = "From: Lynnes Test";
mail ($recipient, $subject, $message, $extra);
echo "Thank you for submitting";
echo "</body></html>"
?>