Hi All.
I have a form which when completed submits data to a mySQL database. This all works fine.
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
lots of other form related staff, then,
<input type="submit" class="visitortextnormal" value="Insert record">
The current action reads:
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO phoenix (id, `month`, `day`, `year`, name, comment, email, country) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id'], "int"),
GetSQLValueString($_POST['month'], "text"),
GetSQLValueString($_POST['day'], "text"),
GetSQLValueString($_POST['year'], "text"),
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['comment'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['country'], "text"));
mysql_select_db($database_phoenix, $phoenix);
$Result1 = mysql_query($insertSQL, $phoenix) or die(mysql_error());
$insertGoTo = "phoenix_house_bulgaria_thankyou_bulgarian.htm";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
Is there a way I can introduce a send email action at the same time.
I have been playing around with this for hours, can you help please.