codeigniter populate form from database
- by Delirium tremens
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?