【发布时间】:2009-05-26 13:49:42
【问题描述】:
在控制器中,我有...
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);
}
在视图中,我有...
<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() 没有读取 $data
搜索 value=""
http://codeigniter.com/forums/viewthread/103837/
发帖者只使用了"" in value=""之间的set_value()函数。
我想知道如何做同样的事情,但我无法让它工作。帮忙?
【问题讨论】:
-
为什么要在控制器而不是模型中提取数据?
-
因为他(我们)可以……并且想要。 ;)
标签: forms codeigniter