编辑记录时收到以下错误消息:Message: Undefined variable: keys
这是我的视图,带有操作按钮propertie_key_list
;
<?php foreach ($ci_broker_propertie_key as $keys) : ?>
<tr>
<!--<th><?= $keys['propertie_key_id'] ?></th>-->
<th><?= $keys['chave_descricao'] ?></th>
<th><?= $keys['chave_codigo'] ?></th>
<th><?= $keys['chave_status'] ?></th>
<th>
<div><a title="Delete" class="delete btn btn-sm btn-danger pull-right '.$disabled.'" data-href="<?php echo base_url('user/propertie_key/del/'.$keys['propertie_key_id']);?>" data-toggle="modal" data-target="#confirm-delete"> <i class="material-icons">delete</i></a></div>
<div><a title="Edit" class="update btn btn-sm btn-primary pull-right" href="<?php echo base_url('user/propertie_key/edit/'.$keys['propertie_key_id']);?>"> <i class="material-icons">edit</i></a></div>
<div><a title="View" class="view btn btn-sm btn-info pull-right" href="<?php echo base_url('user/propertie_key/edit/'.$keys['propertie_key_id']);?>"> <i class="material-icons">visibility</i></a></div>
</th>
</tr>
<?php endforeach ?>
这是我的观点propertie_key_edit
出现错误的地方
<?php echo form_open(base_url('user/propertie_key/edit/'.$keys['propertie_key_id']), 'class="form-horizontal"')?>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-5 form-control-label">
<label for="chave_descricao">Nome</label>
</div>
<div class="col-lg-8 col-md-10 col-sm-8 col-xs-7">
<div class="form-group">
<div class="form-line">
<input type="text" id="chave_descricao" name="chave_descricao" value="<?= $keys['chave_descricao']; ?>" class="form-control">
</div>
</div>
</div>
</div>
第一步是从]中更改按钮url中的url>
base_url('user/propertie_key/edit/'.$keys['propertie_key_id']);
到
base_url('user/propertie_key/edit/&k='.$keys['propertie_key_id']);
(注意&k =)然后,当您调用fopen函数时,请像这样使用GET参数
form_open(base_url('user/propertie_key/edit/'.$_GET['k']);