Try this...[php]
<?
include("test.php");
mysql_select_db("a2840013_Database",$cipai) or die ("Cannot Connect At Delete Form");
$not_deleted = array(); //TO SAVE DELETED IDS
foreach($_POST[checkbox] as $key=>$selected_id)
{
if (!mysql_query("DELETE FROM `customer` WHERE `id_Customer` = '".$selected_id."'"))
array_push($not_deleted, $selected_id);
}
echo "Successfully deleted:<br/>".implode(",", array_diff($_POST[checkbox], $not_deleted));
if (count($not_deleted)>0)
echo "<br/>Unable to delete:<br/>".implode(",", $not_deleted);
?>
[/php]
i have write it like this...
[php]
<?
include("test.php");
mysql_select_db("a2840013_Database",$cipai) or die ("Cannot Connect At Delete Form");
$not_deleted = array();
foreach($_POST[checkbox] as $key=>$selected_id)
{
if (!mysql_query("DELETE FROM customer WHERE id_Customer = '".$selected_id."'"))
array_push($not_deleted, $selected_id);
}
echo "Successfully deleted:<br/>".implode(",", array_diff($_POST[checkbox], $not_deleted));
if (count($not_deleted)>0)
echo "<br/>Unable to delete:<br/>".implode(",", $not_deleted);
?>
[/php]
but the result is... Successfully deleted: and with "," in the new line...
if i try delete 3 record then ",," just like that...or maybe in my delete.php something wrong? this is the code
[php]
<?
echo "<form method='POST' action='del_cust.php'>";
while($row=mysql_fetch_assoc($result)){
echo "<table width ='100%'+ border='1'>";
echo "
<tr>
<td><input type='checkbox' name='checkbox[]' value=''.$row[id_Customer].''></input></td>
<td width = '10%'> $row[id_Customer] </td>
<td width = '30%'> $row[Nama_Customer] </td>
<td width = '20%'> $row[Alamat] </td>
<td width = '10%'> $row[Kota] </td>
<td width = '20%'> $row[C_Person] </td>
<td width = '5%'align='center'> $row[Nom] </td>
</tr>
</table>";
}
echo "<input type='submit' value='Submit' name='submit'>";
echo "</br><input type='text' name='nomdat'>";
echo"</form>";
$Te =mysql_num_rows($result);
echo "<b><font color='blue'><h3> Jumlah Record Customer Tersimpan= $Te </h3></b></font>";
?>
[/php]
thank you for all your help...