简体   繁体   English

当我单击php中的保存amt按钮时如何更新复选框选中的行

[英]How can i update checkbox checked rows when i click on save amt button in php

I want to update checkbox checked rows when i click on save amt button. 当我单击保存amt按钮时,我想更新复选框选中的行。 Please help me i getting error. 请帮助我,我得到错误。

<?php
include_once("config.php");
if(isset($_POST['submit']))
{
  $paitAmt = $_POST['paidamt'];
  $uid = $_POST['uid'];
  $array = array($paitAmt, $uid);
  foreach ($array as list($paitAmt, $uid)) {
  $sql = "UPDATE tbldemo SET paidAmt = '$paitAmt' WHERE id = '$uid'";
  echo $sql;
  $result = mysql_query($sql);
  echo 'Updated Successfully';
  }
}
?>

在此处输入图片说明

Try this: 尝试这个:

<?php
include_once("config.php");
if(isset($_POST['submit']))
{
  $paitAmt = $_POST['paidamt'];
  $uid = $_POST['uid'];
  foreach ($paitAmt as $key=>$value) {
  $sql = "UPDATE tbldemo SET paidAmt = '$value' WHERE id = '{$uid[$key]}'";
  //echo $sql;
  $result = mysql_query($sql);
  echo 'Updated Successfully';
  }
}
?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 选中复选框时,如何使用 php 更新 mysql 数据库中的值? - How can i update a value in mysql database with php when a checkbox is checked? 使用 Jquery 和 PHP 单击保存按钮时,如何将多个表行更新为 mysql 表? - How to update multiple table rows into mysql table when click save button using Jquery and PHP? 没有提交按钮进行检查时,如何获取复选框名称 - how can i get checkbox name when checked without submit button 选中初始复选框时(如何使用PHP / Javascript)如何显示多个复选框 - How can I have multiple checkboxes appear when initial checkbox is checked (using PHP/Javascript) Php:如何在不提交表单的情况下检查复选框是否被选中? - Php: How can I check if a checkbox is checked without submitting the form? 如果在 html 表中选中复选框,那么我想在按下更新按钮时更新该行的值 - if checkbox is checked in html table then i want to update the value of that row when update button is pressed 使用循环选中复选框时,如何显示值? - How can i show value when checkbox was checked using loop for? 如果复选框选中了多行,则更新值 - Update value if the checkbox if checked multiple rows php 我使用php创建了一个动态复选框,但是当我使用.checked()进行检查时,仅选中了第一个单选按钮。 如何检查其余部分? - I have created a dynamic checkbox using php, but when i use .checked() to check it, only first radio button is checked. how to check the rest? 我如何检查是否未选中复选框 - How can I check if a checkbox is NOT checked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM