Welcome Guest, Not a member yet? Register   Sign In
Form Post and Library Redeclare problem
#1

[eluser]monkeypaw201[/eluser]
I have a controller called MyAccount and a class called Account. MyAccount has a form which posts to itself and if validated updates the database. Unfortunately, I get an error and am unsure as to how it happened and how to fix it.

Error Message
Quote:Fatal error: Cannot redeclare class Account in /home/oitech/public_html/system/application/libraries/account.php on line 3

MyAccount Controller
Code:
<?php

class MyAccount extends Controller {

    function MyAccount()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->library('data');
        $this->load->library('account');
        $this->load->library('form_validation');
        $this->load->helper(array('form', 'url'));
        
        $this->form_validation->set_rules('fname', 'First Name', 'required');
        $this->form_validation->set_rules('lname', 'Last Name', 'required');
        $this->form_validation->set_rules('email', 'Email Address', 'required');
        $this->form_validation->set_rules('address1', 'Address', 'required');
        $this->form_validation->set_rules('city', 'City', 'required');
        $this->form_validation->set_rules('state', 'State/Province', 'required');
        $this->form_validation->set_rules('zip', 'Zip Code', 'required');
        $this->form_validation->set_rules('phone', 'Phone Number', 'required');
        
        if ($this->form_validation->run() == FALSE)
        {
            $data = array(
                    'countrydropdown' => $this->data->countrydropdown($this->account->data('country')),
                    'fname' => $this->account->data('fname'),
                    'lname' => $this->account->data('lname'),
                    'company' => $this->account->data('company'),
                    'email' => $this->account->data('email'),
                    'address1' => $this->account->data('address1'),
                    'address2' => $this->account->data('address2'),
                    'city' => $this->account->data('city'),
                    'state' => $this->account->data('state'),
                    'zip' => $this->account->data('zip'),
                    'country' => $this->account->data('country'),
                    'phone' => $this->account->data('phone'),
                    );
            $this->parser->parse('account',$data);
        }else{
            $this->account->update('fname',$this->input->post('fname'));
            $this->account->update('lname',$this->input->post('lname'));
            $this->account->update('company',$this->input->post('company'));
            $this->account->update('email',$this->input->post('email'));
            $this->account->update('address1',$this->input->post('address1'));
            $this->account->update('address2',$this->input->post('address2'));
            $this->account->update('city',$this->input->post('city'));
            $this->account->update('state',$this->input->post('state'));
            $this->account->update('zip',$this->input->post('zip'));
            $this->account->update('country',$this->input->post('country'));
            $this->account->update('phone',$this->input->post('phone'));
        }
    }
}


Messages In This Thread
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 10:49 AM
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 12:19 PM
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 05:27 PM
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 06:37 PM
Form Post and Library Redeclare problem - by El Forum - 01-23-2010, 08:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB