How to modify php batch POST: 1. Add [[]] to the name in the front-end form, and the code is [<input type="hidden" name="id[]" value="{$vo.id}">]; 2. The backend accepts [$id = $_POST [id] [$i]].
How to modify php batch POST:
Add []## to the name in the front-end form #, such as:
<input type="hidden" name="id[]" value="{$vo.id}">
php programming (video)]
Front-end form:
Server-side processing:
/** * 批量修改状态 */ public function updateList() { $result = false; for($i = 0; $i < count ( $_POST [id] ); $i ++) { $id = $_POST [id] [$i]; $check = $_POST [check] [$i]; $status = $_POST [status] [$i]; // 保存登录信息 $Repair = M ( 'Repair' ); $data ['id'] = $id; $data ['check'] = $check; $data ['status'] = $status; $result = $Repair->save ( $data ); } if (false !== $result) { $this->success ( '修改成功!' ); } else { $this->error ( '修改失败!' ); } }
Programming video]
The above is the detailed content of How to batch POST modification in php. For more information, please follow other related articles on the PHP Chinese website!