本文介绍了设置值默认代码点火器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此功能(get_profile_info)
I have this function (get_profile_info)
function get_profile_info()
{
$this->db->where('username',$this->session->userdata('username'));
$get_profile_info = $this->db->get('memberships');
if($get_profile_info->num_rows() == 1){
foreach ($get_profile_info->result() as $row)
{
echo $row->firstname;
echo $row->lastname;
}
}
}
问题是我如何将结果:名字和姓氏输入默认输入形式set_value: echo Firstname .form_input('firstname2');
The question is how do i put this results: firstname and lastname into input form default set_value: echo "Firstname".form_input('firstname2');
推荐答案
尝试一下
function get_profile_info()
{
$this->db->where('username',$this->session->userdata('username'));
$get_profile_info = $this->db->get('memberships');
if($get_profile_info->num_rows() == 1){
return $get_profile_info->row();
}
function your_controller
{
$data['row'] = get_profile_infor()
$this->load->view("yourview",$data)
}
IN视图
<input type="text" name="firstname" value="<?php echo set_value('firstname',$row->firstname)?>" />
<input type="text" name="lastname" value="<?php echo set_value('lastname',$row->lastname)?>" />
这篇关于设置值默认代码点火器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!