Welcome Guest, Not a member yet? Register   Sign In
Dont repeat myself...? -- Populating dropdown with DB data
#1

[eluser]rvent[/eluser]
Hello,

I am back at my CI intranet project and i have found this post: http://ellislab.com/forums/viewthread/64256/

I ended up with the following function in the controller:
Code:
function listPrio()
    {
        $dbres = $this->Boards->createBoard();
        $ddmenu = array();
        
        foreach($dbres->result_array() as $row)
        {
            $ddmenu[$row['PartPriorityID']] = $row['PartPriority'];
        }
        
        $data['options'] = $ddmenu;
        $this->load->view('test', $data);
    }

Function in the Model:
Code:
function createBoard()
    {
        $this->db->select('PartPriority, PartPriorityID');
        $this->db->from('PartPriority');
        
        $priority = $this->db->get();
        return $priority;
    }

And view:
Code:
<html>
    <head>
        <title>Test</title>
    </head>
    <body>
    hello
        <form>
        <?php form_dropdown('Prioprity', $options); ?>
        </form>
    </body>
</html>

But i get a blank page..

Any ideas..?


Thanks


Messages In This Thread
Dont repeat myself...? -- Populating dropdown with DB data - by El Forum - 01-08-2008, 01:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB