Home > Backend Development > PHP Tutorial > 删除复选框选中的数据,不管选中多少,传过去的值只有一个,请哪里的有关问题

删除复选框选中的数据,不管选中多少,传过去的值只有一个,请哪里的有关问题

PHP中文网
Release: 2023-02-28 13:26:01
Original
1032 people have browsed it

问题:

删除复选框选中的数据,不管选中多少,传过去的值只有一个,请哪里的问题

<br>
<table width="49%" cellspacing="1" bgcolor="#0093C4" id=&#39;demotable1&#39;><br>
   <thead><br>
     <tr><br>
       <th width="3%"><INPUT name="chkAll" id="chkAll" title="全选" onClick="ChkAllClick(&#39;delivery[]&#39;,&#39;chkAll&#39;)" type="checkbox" /></th><br>
       <th width="8%" class="STYLE3">Item Code</th><br>
       <th width="12%" class="STYLE3">SKU</th><br>
       <th width="15%" class="STYLE3">ASIN</th><br>
       <th width="21%" class="STYLE3">Description</th><br>
       <th width="12%" class="STYLE3">Type</th><br>
       <th width="9%" class="STYLE3">Delivery Areas</th><br>
       <th width="10%" class="STYLE3">Account</th><br>
       <th width="10%" class="STYLE3">FNSKU</th><br>
     </tr><br>
   </thead><br>
   <tbody><br>
     <?PHP<br>
  while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {<br>
  ?><br>
     <tr><br>
       <td><input type="checkbox" name="delivery[]" value="<?PHP echo $row[&#39;id&#39;]; ?>" /></td><br>
       <td><?PHP echo $row[&#39;item_code&#39;] ?></td><br>
       <td><?PHP echo $row[&#39;sku&#39;] ?></td><br>
       <td><?PHP echo $row[&#39;asin&#39;] ?></td><br>
<br>
<br>
Copy after login
<br>
function delClick(){  <br>
var val = $(&#39;input:checked&#39;).val();    <br>
 window.location.href="http://www.php1.cn/">
<br>
} <br>
Copy after login
<br>
<br>
        <input type="button" class="btn" id="add_btn"  value="新 增" /><br>
       <br>
          <input name="button" type="button" class="btn" onclick="delClick()" value="删 除" /><br>
Copy after login
<br>
    case &#39;del&#39; : //删除<br>
    <br>
$id=$_GET["delivery"];<br>
$SQL = "delete from `sku_rule` where id in($id)";<br>
        $result = mysql_query($SQL);<br>
        if (mysql_affected_rows($conn) != 1){<br>
        <br>
            echo "<script>alert(&#39;删除失败!&#39;);location.href="http://www.php1.cn/">
        } else {<br>
        <br>
            echo "<script>alert(&#39;删除成功!&#39;);location.href="http://www.php1.cn/">
        }<br>
        break;<br>
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template