第一次html请求是get请求 所以会直接执行 include $this->template()。这样就会直接执行 2html 页面。但是 2html 的<input type='hidden' name='id' value='{$id}' />
并没有获得id值。因为第一次html请求的值并没有包含进去,需要定义一个 $id = $_GPC['id'];
。这样就和 2html的 value='{$id}'
就会获得值。当 2html 进行** post请求**时,后台php就会更新。从而更新数据库。
而我第一次写的时候,并没有定义 $id = $_GPC['id'];
。这样就导致了 2html 中的 value='{$id}'
,取不到值,当 2html 进行** post请求时php后台也去不到id**的值,这样虽然页面刷新,但数据没有更新。
1html
1 2 3
| <a class='btn btn-default btn-sm' data-toggle="ajaxModal" href="{php echo webUrl('share/exchangelist/remarksaler', array('id' => $item['id']))}" title="不通过申请"><i class='fa fa-remove'></i> </a>
请求url 把id传到后台php
|
后台php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| public function remarksaler() { global $_W; global $_GPC;
$id = $_GPC['id']; $item = pdo_fetch('select * from '.tablename('weikang_deposit_refund').' where uniacid =:uniacid and id =:id ',array('id' => $_GPC['id'], 'uniacid' => $_W['uniacid'])); if ($_W['ispost']) { pdo_update('weikang_deposit_refund', array('fail_message' => $_GPC['remark'],'draw_status' => 2), array('id' => $_GPC['id'], 'uniacid' => $_W['uniacid'])); show_json(1,array("url"=>webUrl('share/exchangelist'))); } include $this->template(); }
|
2html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| <form class="form-horizontal form-validate" action="{php echo webUrl('share/exchangelist/remarksaler')}" method="post" enctype="multipart/form-data"> <input type='hidden' name='id' value='{$id}' />
<div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button data-dismiss="modal" class="close" type="button">×</button> <h4 class="modal-title">失败原因</h4> </div> <div class="modal-body"> <textarea style="height:150px;" class="form-control" name="remark" placeholder="失败原因" >{$item['fail_message']}</textarea> </div> <div class="modal-footer"> <button class="btn btn-primary" type="submit">提交</button> <button data-dismiss="modal" class="btn btn-default" type="button">取消</button> </div> </div> </form>
|