jeg har fået lavet noget sammen, men den vil ikke slette når jeg kliker på slet knappen,
<?php
include("cn.php");
include("common.php");
checklogin();
$msg = "";
if(isset($_POST['Submit']))
{
$total = $_POST['total'];
$td = 0;
$i = 0;
for($i = 1; $i <= $total; $i++)
{
if(isset($_POST["d$i"]))
{
mysql_query("DELETE FROM Bnc_kunder WHERE navn=".$_POST["d$i"]);
$td++;
}
}
$msg = "$td Kende deleted!";
}
$result = mysql_query("SELECT * FROM `Bnc_kunder` WHERE 1");
$num = mysql_num_rows($result);
$n = 0;
?>
<html>
<head>
<title>Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h3>Bnc Kunder</h3>
<p><?php echo $msg?></p>
<form name="form1" method="post" action="">
<p> </p>
<table width="49%" border="1" cellpadding="1" cellspacing="1" bordercolor="#000000" style="border-width: 0px">
<tr bgcolor="#CCCCCC">
<td width="3%" bgcolor="#FFFFFF" style="border-style: none; border-width: medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font></td>
<td width="97%" bgcolor="#FFFFFF" style="border-style: none; border-width: medium"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Category
</strong></font></td>
</tr>
<?php while($row = mysql_fetch_array($result, MYSQL_BOTH)){
$n++;
?>
<tr>
<td style="border-style: none; border-width: medium"><input type="checkbox" name="d<?php echo $n;?>" value="<?php echo $row['navn'];?>"></td>
<td style="border-style: none; border-width: medium"><a href="newrecord.php?navn=<?php echo $row['navn']?>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row['navn'];?></font></a></td>
</tr>
<?php
}?>
<tr>
<td style="border-style: none; border-width: medium"> </td>
<td style="border-style: none; border-width: medium"> <input name="total" type="hidden" id="total" value="<?php echo $n?>"></td>
</tr>
<tr>
<td style="border-style: none; border-width: medium"> </td>
<td style="border-style: none; border-width: medium"><input type="submit" name="Submit" value="Delete"></td>
</tr>
</table>
<p> </p></form>
<p> </p>
<p><a href="admin.php">Main</a></p>
<p align="center"> </p>
<p> </p>
</body>
</html>
[Redigeret d. 13/10-05 17:28:44 af Caspar]