先附上我的程式碼
<button class="box" data-removetype="select_del">刪除</button>
<form id="selectid">
<? while ($row = mysql_fetch_array($s))
{
<input type="checkbox" name="id[]" value="<? echo $row['mail_id'];?>">
}
?>
</form>
$(".box").click(function(e){
var removetype = e.currentTarget.dataset.removetype;
/*mailbox*/
if (removetype=='select_del')
{
$.ajax({
type: "POST",
url:"del?to="+removetype,
data:$("#selectid").serialize(),
cache: false,
success: function(){
}
});
}
});
del
$user = $_GET['to'];
if ($user=='select_del')
{
$getid=$_POST['id'];
foreach($getid as $value)
{
$DEL = mysql_query("
DELETE FROM `資料表名稱`
WHERE `id` = '".$value."'
");
}
}
以上是我的程式碼...
但卻無法運作
所以我想問看看這樣做法是不是對的?
確定id與資料表名稱無誤