Thinkphp has some issues about passing parameters to view
给我你的怀抱
给我你的怀抱 2017-07-05 09:56:02
0
2
889

Click on the a tag to transmit the parameter id to the controller. The controller queries the record value of the id row from the data table and displays it in the view through assign. However, when clicking on different links, the first row of records in the data table is displayed. Is there something wrong with the writing on the controller side?

<a href="{:U('MemberList/update?username=')}{$v.username}">编辑</a> 
public function update($username)
{
    //默认显示添加表单
    if (!IS_POST) {
        $model = M('register')->find(I('$username'));;
        $this->assign('model',$model);
        $this->display();
    }
    //…………
}
<form action="{:U('MemberList/update?username=')}{$model.username}" method="post">
    <p class="form-group">
        <label>学员名称</label>
        <input class="form-control" type="text" name="username" value="{$model.username}">
    </p>
<form>
给我你的怀抱
给我你的怀抱

reply all(2)
洪涛

{:U('MemberList/update',array('username'=>$v['username']))}

伊谢尔伦

The correct answer on the first floor, read more documents to get the truth

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template