class form_setup_account { public $id; public $db_name; public $config; public $validation; public $reasons; public function __construct($context) { $this->id = $context['id']; $this->db_name = $context['db_name']; } public function set() { global $database; $id = $this->id; $db_name = $this->db_name; $this->default_country = 27; if(!empty($id)) { $get_invoice = " SELECT * FROM $db_name"."account WHERE id = '$id' LIMIT 1 "; $results = $database->getRow($get_invoice); $this->id = $results['id']; $this->default_country = $results['default_country']; $this->default_country = 27; $this->company_name = $results['company_name']; $this->address = $results['address']; $this->suburb = $results['suburb']; $this->state = $results['state']; $this->post_code = $results['post_code']; $this->phone = $results['phone']; $this->abn = $results['abn']; $this->fax = $results['fax']; $this->website = $results['website']; $this->domain = $results['domain']; $this->time_zone = $results['time_zone']; } if($_POST['Submit'] == "Save") { $this->company_name = mysql_real_escape_string($_POST['company_name']); $this->default_country = mysql_real_escape_string($_POST['default_country']); $this->address = mysql_real_escape_string($_POST['address']); $this->suburb = mysql_real_escape_string($_POST['suburb']); $this->state = mysql_real_escape_string($_POST['state']); $this->post_code = mysql_real_escape_string($_POST['post_code']); $this->phone = mysql_real_escape_string($_POST['phone']); $this->fax = mysql_real_escape_string($_POST['fax']); $this->abn = mysql_real_escape_string($_POST['abn']); $this->website = mysql_real_escape_string($_POST['website']); $this->domain = mysql_real_escape_string($_POST['domain']); $this->time_zone = mysql_real_escape_string($_POST['time_zone']); } $this->config['company_name'] = array("id"=> $id,"value"=> $this->company_name, "input_name" => "company_name", "name" => "Company Name","rule" => "required"); $this->config['default_country'] = array("id"=> $id,"value"=> $this->default_country, "input_name" => "default_country", "name" => "Default Country","rule" => "required|integer"); $this->config['address'] = array("id"=> $id,"value"=> $this->address, "input_name" => "address", "name" => "Address","rule" => "required"); $this->config['suburb'] = array("id"=> $id,"value"=> $this->suburb, "input_name" => "suburb", "name" => "Suburb","rule" => "required"); $this->config['state'] = array("id"=> $id,"value"=> $this->state, "input_name" => "state", "name" => "State","rule" => "required"); $this->config['post_code'] = array("id"=> $id,"value"=> $this->post_code, "input_name" => "post_code", "name" => "Post Code","rule" => "required|integer|exact_length[4]"); $this->config['phone'] = array("id"=> $id,"value"=> $this->phone, "input_name" => "phone", "name" => "Phone","rule" => "required"); $this->config['fax'] = array("id"=> $id,"value"=> $this->fax, "input_name" => "fax", "name" => "Fax","rule" => "required"); $this->config['abn'] = array("id"=> $id,"value"=> $this->abn, "input_name" => "abn", "name" => "ABN","rule" => "required"); $this->config['website'] = array("id"=> $id,"value"=> $this->website, "input_name" => "website", "name" => "Website","rule" => ""); $this->config['domain'] = array("id"=> $id,"value"=> $this->domain, "input_name" => "domain", "name" => "Sub Domain","rule" => "required|sub_domain"); $this->config['time_zone'] = array("id"=> $id,"value"=> $this->time_zone, "input_name" => "time_zone", "name" => "Time Zone","rule" => "required"); self::run_validation(); } public function run_validation() { $id = $this->id; $static_function = (($_POST['Submit'] == "")) ? "initial" : "validate"; $this->validation['company_name'] = validation::$static_function($this->config['company_name']); $this->validation['default_country'] = validation::$static_function($this->config['default_country']); $this->validation['address'] = validation::$static_function($this->config['address']); $this->validation['suburb'] = validation::$static_function($this->config['suburb']); $this->validation['state'] = validation::$static_function($this->config['state']); $this->validation['post_code'] = validation::$static_function($this->config['post_code']); $this->validation['phone'] = validation::$static_function($this->config['phone']); $this->validation['fax'] = validation::$static_function($this->config['fax']); $this->validation['abn'] = validation::$static_function($this->config['abn']); $this->validation['website'] = validation::$static_function($this->config['website']); $this->validation['domain'] = validation::$static_function($this->config['domain']); $this->validation['time_zone'] = validation::$static_function($this->config['time_zone']); $this->reasons = validation::formalise($this->validation); } public function form() { global $database; $id = $this->id; $default_country = $this->default_country; $config = $this->config; $validation = $this->validation; $text_options = array("class" => "medium"); $text_area_options = array("class" => "medium"); $select_options = array("class" => "medium form"); ?>
Business name : |