$formnames) {
// print the heading line
$email_text .= "
$heading:";
// now loop through the formnames sub-array and print the field name and its value
foreach ($formnames as $fieldname) {
$fieldvalue = htmlentities($_POST[$fieldname]);
if (array_key_exists($fieldname, $conversion_table)) {
$tabel = array();
for ($i=0; $i "ignore") { // field to be ignored?
if ($tabel[1] == "*") // get value from $_POST array value?
$answer = $fieldvalue; // yes: get value from $_POST array
else { // no: get value from conversion table
$ents = (count($tabel)-1)/2; // no of 2-part entries
for ($j=0,$i=1; $j<$ents; $j++,$i+=2) {
if ($fieldvalue == $tabel[$i]) { // compare value (1st part)
$answer = $tabel[$i+1]; // true: get value from 2nd part
break; // break out of FOR loop
} // End IF
} // End FOR
} // End ELSE
} // End IF <> ignore
} // End IF array_key_exists
else { // name not in conversion table:
$label = $fieldname; // display form name
$answer = $fieldvalue; // and form value
} // End ELSEIF array_key_exists
if ($label <> "ignore" && $answer != "") {
$email_text .= "
".$label." : ".$answer;
$answer = "";
} // End IF <> ignore
} // End FOREACH ($formnames)
} // End FOREACH ($Headings)
// ===============================================================================
// Now all information is stored in the $email_text variable. Handle it
// ===============================================================================
if ($email_text == "")
echo "No form input to send
";
else {
// print the information on the screen
echo "$email_text
";
// build and send the information in an e-mail message
// translate the indentation chars to blanks and the breaks to newlines
$email_text = str_replace(array("
", " "), array("\n", " "), $email_text);
$email_subj = "This is a confirmation e-mail for the Golf Form";
$email_hdrs = "From: chris@omega-products.com";
if (mail($email = "chris@omega-products.com", $email_subj = "Submitted Golf Registration Form", $email_text, $email_hdrs))
echo "You Registration form has been successfully sent";
else
echo "Mailing error!";
}
echo '
';
echo '
';
echo 'Back to Omega-Products.com';
?>