codeigniter populate form from database

Posted by Delirium tremens on Stack Overflow See other posts from Stack Overflow or by Delirium tremens
Published on 2009-05-26T13:49:42Z Indexed on 2010/04/06 17:13 UTC
Read the original article Hit count: 193

Filed under:
|

In the controller, I have...

function update($id = null)
{
    $this->load->database();

    // more code

    $data = array();
    $data = $this->db->get_where(
            'users',
            array(
            'id' => $id
            )
        );
    $data = $data->result_array();
    $data = $data[0];

    // more code

    $this->load->view('update', $data);
}

In the view, I have...

<h5>Username</h5>
<input type="text" name="username" value="<?php echo set_value('username'); ?>" size="50" />

<h5>Email</h5>
<input type="text" name="email" value="<?php echo set_value('email'); ?>" size="50" />

<h5>Email Confirmation</h5>
<input type="text" name="emailconf" value="<?php echo set_value('emailconf'); ?>" size="50" />

<h5>Password</h5>
<input type="text" name="password" value="<?php echo set_value('password'); ?>" size="50" />

<h5>Password Confirmation</h5>
<input type="text" name="passconf" value="<?php echo set_value('passconf'); ?>" size="50" />

set_value() isn't reading $data

search for value=""

at http://codeigniter.com/forums/viewthread/103837/

The poster uses only the set_value() function between "" in value="".

I'm wondering how to do the same, but I can't get it to work. Help?

© Stack Overflow or respective owner

Related posts about codeigniter

Related posts about forms