$_POST[contact_reason]"; } $form = "
Contact Credit Provide
";
// send email...
function check_email($str)
{
//returns 1 if valid email, 0 if not
if(ereg("^.+@.+\\..+$", $str))
return 1;
else
return 0;
}
// form submited?
if($_POST[Submit] == "Send"){
// all fields filled?
if (!$_POST[name] || $_POST[contact_reason]=="Default" || !check_email($_POST[email])){
$error = "* Please fill in all fields below" ;
} else {
// vars
// name of site
$sitename = "Credit Provide form";
// admin email
$admin = "staff@creditprovide.com";
// date
$todayis = date("l, F j, Y, g:i a") ;
// notes - remove url encoding
$send_notes = stripslashes($notes);
// footer
$messagefooter = "
-----------------------------\n
sent: $todayis
";
// base message to send
$messageis = "Credit Provide
name: $_POST[name]\n
email: $_POST[email]\n
Contact Reason: $_POST[contact_reason]\n
Comments:\n$send_notes\n
".$messagefooter . "";
$from = "From: $_POST[email]\r\n";
// send
if(mail($admin, $sitename, $messageis, $from)){
$is_sent = 1;
}
if($is_sent){
$error = "Thank You - your message was sent";
} else {
$error = "* Sorry - your email was not sent, please try again";
}
echo $error;
}
}
if(!$is_sent){
print "$form";
}
?>