name
attribute for that field) along with the value that was sent with it right in the browser window, and then sends it all to an email address (once you've added it to the script).
//////////////// FUNCTIONS //////////////////
//Creates function that removes magic escaping, if it's been applied, from values and then removes extra newlines and returns to foil spammers. Thanks Larry Ullman!
function clear_user_input($value)
{
if (get_magic_quotes_gpc()) $value=stripslashes($value);
$value= str_replace( "\n", '', trim($value));
$value= str_replace( "\r", '', $value);
return $value;
}
function validate($text)
{
if( preg_match("/[^a-zA-Z0-9\(\)\.\-\ \n]+$/s", $text ) )
{
return FALSE;
}
else
{
return TRUE;
}
}
////////////// MAIN BODY //////////////////
// so if we haven't been to the page yet,
// we shouldn't have a submitted variable declared in $POST!
if(! $_POST['submitted'])
{
print "Please use the form below and we will get back to you as soon as possible.
"; ?> } else //we had a submitted variable declared...so we say thanks... { //removes newlines and returns from $email and $name so they can't smuggle extra email addresses for spammers $email = clear_user_input($email); $name = clear_user_input($name); $date = $_POST['date']; $email = $_POST['email']; $telephone = $_POST['telephone']; $location = $_POST['location']; $emailMessage = "SCHEDULE REQUEST\n \n From: $name\n \n Telephone: $telephone\n E-mail: $email\n Date Requested: $date\n Location: $location\n \n --------------------------------------------------------------- Message:\n $message\n \n "; $contactemail = "info@lucaspaulband.com"; $myemail = "Lucas Paul Website"; $headers .= "MIME-Version: 1.0\n"; $headers .= "From: ".$myname."Thanks for your request! We will get back to you as soon as possible.
"; } else { print "Oops! We had a technical error, please call us at 734.323.7480"; } } ?>