首頁  >  文章  >  後端開發  >  删除复选框选中的数据,不管选中多少,传过去的值只有一个,请哪里的有关问题

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

PHP中文网
PHP中文网原創
2017-03-21 14:07:19847瀏覽

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

<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>
<br>
function delClick(){  <br>
var val = $(&#39;input:checked&#39;).val();    <br>
 window.location.href="http://www.php1.cn/">
<br>
} <br>
<br>
<br>
        <input type="button" class="btn" id="add_btn"  value="新 增" /><br>
       <br>
          <input name="button" type="button" class="btn" onclick="delClick()" value="删 除" /><br>
<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>


陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn