Welcome Guest, Not a member yet? Register   Sign In
Form field data pulled from database
#3

[eluser]mdcode[/eluser]
Sorry jedd - I'm usually good at writing error and bug reports, and when I say it's not doing anything, I literally mean, it's not doing anything, no messages, no errors, all I have the select box. Also I did not think that code was required in this instance...

Still, while waiting I have done some more work and sort of getting a little closer I think with it, but if it helps, here's the code I have so far:

Model:
Code:
function get_all_field_data($data)
    {
        $data = array(
            'customer' => $this->db->get('customers')
        );
    }
    
    function add()
    {
        $input = array(
            'customer' => $this->input->post('customer'),
            'division' => $this->input->post('division'),
            'dateRequired' => $this->input->post('dateRequired'),
            'tech' => $this->input->post('tech'),
            'rep' => $this->input->post('rep'),
            'priority' => $this->input->post('priority'),
            'allocatedTime' => $this->input->post('allocatedTime')
            );
            
            $this->db->insert('projects', $input);
        
        // $this->db->query("INSERT INTO projects (id, customer, division, dateRequired, tech, rep, priority, allocatedTime) VALUES");
    }

Controller:
Code:
function __construct()
    {
        parent::Controller();
        
        /* load the session library */
        $this->load->library('session');
        
        /* set the template for the site */
        $this->template->set_master_template('default/template_main.php');
        
        /* load in the required models */
        $this->load->model('projects_model', '', TRUE);
    }
    
    function index()
    {
        $data['siteTitle'] = $this->config->item('siteTitle');
        $this->template->write_view('content', 'default/pages/projects_index', $data);
        $this->template->render();
    }
    
    function add()
    {
        $data['siteTitle'] = $this->config->item('siteTitle');
        $this->template->write_view('content', 'default/admin/projects_add', $data);
        $this->template->render();
    }

View:
Code:
echo form_open('models/project_model');
echo "<span class='fontSubH'>Main Detail<br /></span>";
echo form_label('Customer','customer'); "&nbsp;";
echo form_dropdown('customer',$this->projects_model->data['customer']);

Now with the changes that I have done while waiting for replies, I am getting errors:

Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Projects_model::$data
Filename: admin/projects_add.php
Line Number: 20
and
Code:
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: helpers/form_helper.php
Line Number: 268


Messages In This Thread
Form field data pulled from database - by El Forum - 03-16-2009, 06:54 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:09 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:28 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:49 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:55 PM
Form field data pulled from database - by El Forum - 03-16-2009, 07:56 PM
Form field data pulled from database - by El Forum - 03-16-2009, 08:04 PM
Form field data pulled from database - by El Forum - 03-16-2009, 08:12 PM
Form field data pulled from database - by El Forum - 03-16-2009, 08:24 PM
Form field data pulled from database - by El Forum - 03-16-2009, 09:23 PM
Form field data pulled from database - by El Forum - 03-16-2009, 09:58 PM
Form field data pulled from database - by El Forum - 03-16-2009, 11:17 PM
Form field data pulled from database - by El Forum - 03-17-2009, 03:14 AM
Form field data pulled from database - by El Forum - 03-17-2009, 03:30 PM
Form field data pulled from database - by El Forum - 03-18-2009, 06:17 AM
Form field data pulled from database - by El Forum - 03-18-2009, 07:58 AM
Form field data pulled from database - by El Forum - 03-18-2009, 04:17 PM
Form field data pulled from database - by El Forum - 03-18-2009, 05:38 PM
Form field data pulled from database - by El Forum - 03-18-2009, 06:51 PM
Form field data pulled from database - by El Forum - 03-18-2009, 07:10 PM
Form field data pulled from database - by El Forum - 03-18-2009, 07:22 PM
Form field data pulled from database - by El Forum - 03-18-2009, 07:44 PM
Form field data pulled from database - by El Forum - 03-18-2009, 09:00 PM
Form field data pulled from database - by El Forum - 03-18-2009, 09:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB