Email Confirmation

Thank you for your enquiry.
Your email has been sent to the club officer selected.
get_row(“SELECT * FROM wp_formmaker_submits WHERE form_id=15 AND date >= Date_Add(now(), INTERVAL -2 HOUR) ORDER BY date DESC”);
/*now select all the relevant records with same groupid*/
$wantedgroupid = $lastrecord->group_id;
$select = “SELECT * FROM wp_formmaker_submits WHERE group_id='”. $wantedgroupid. “‘”;
$records =$wpdb->get_results($select);
foreach ( $records as $record )
{
if ($record->element_label == “3”) { $subject = $record->element_value;}
if ($record->element_label == “1”) { $message = $message. “From: “. $record->element_value. “\r\n” ;}
$message = str_replace(“@@@”,” “,$message);
if ($record->element_label == “2”) {
$to = $record->element_value;
$message = $message. “Email: “. $record->element_value. “\r\n” ;
$message = $message. “Be sure to use this email address to reply (use Forward in your email)”. “\r\n\r\n”;}
if ($record->element_label == “4”) { $message = $message. $record->element_value;}
if ($record->element_label == “8”) {
$message = “To: CCRC “. $record->element_value. “\r\n\r\n”. $message;
if ($record->element_value == “Commodore”) { $headers[] = “Bcc: commodore@ccrc.co.uk”;}
if ($record->element_value == “Vice Commodore”) { $headers[] = “Bcc: commodore@ccrc.co.uk”;}
if ($record->element_value == “Secretary”) { $headers[] = “Bcc: secretary@ccrc.co.uk”;}
if ($record->element_value == “Sailing Secretary”) { $headers[] = “Bcc: sailingsecretary@ccrc.co.uk”;}
if ($record->element_value == “Treasurer”) { $headers[] = “Bcc: treasurer@ccrc.co.uk”;}
if ($record->element_value == “Web Master”) { $headers[] = “Bcc: webmaster@ccrc.co.uk”;}
}
}
$headers[] = ‘From: CCRC ‘;
wp_mail( $to, $subject, $message, $headers );
/* now wait 5 seconds and redirect*/
header( “refresh:5; url=https://www.ccrc.co.uk” );
?>

This page will move on after 5 seconds.