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>
伊谢尔伦2017-07-05 09:58:02
The correct answer on the first floor, read more documents to get the truth