Created
May 30, 2009 13:54
-
-
Save walterdavis/120506 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(isset($_POST['save'])){ | |
$person->populate(clean($_POST)); | |
$person->save(); | |
if(!$person->get_errors()){ | |
//everything has been saved | |
//send two mail messages | |
mail(ADMIN_EMAIL,'New contact from the Web site',print_r($person,true),'From: ' . ADMIN_EMAIL,'-f' . ADMIN_EMAIL); | |
mail($person->email,AUTOREPLY_SUBJECT,AUTOREPLY_MESSAGE,'From: ' . ADMIN_EMAIL,'-f' . ADMIN_EMAIL); | |
//redirect | |
header('Location: ' . THANKS_PAGE); | |
}else{ | |
//make a list of errors | |
$errors = '<ul class="errors">'; | |
foreach($person->get_errors() as $e) $errors = '<li>' . $e . '</li>'; | |
$errors = '</ul>'; | |
//print these out later in your page with <?=$errors?> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment