Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PageController {
- var $person; #$person is used by the HTML page
- var $errs;
- function PageController() {
- $action = Form::getParameter('cmd');
- $this->person = new Person();
- $this->errs = array();
- if ($action == 'save') {
- $this->parseForm();
- if (!this->validate()) return;
- NewsletterLogic::subscribe($this->person);
- header('Location: confirmation.php');
- exit;
- }
- }
- function parseForm() {
- $this->person->name = Form::getParameter('name');
- $this->person->birthdate = Util::parseDate(Form::getParameter('birthdate');
- ...
- }
- function validate() {
- if ($this->person->name == '') $this->errs['name'] = FORM_MISSING;
- #FORM_MISSING is a constant
- ...
- return (sizeof($this->errs) == 0);
- }
- }
Add Comment
Please, Sign In to add comment