<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$con = mysql_connect("localhost:3306", "root", "");
mysql_select_db("dvdclub", $con);
$result = mysql_query("select * from customer");
?>
<form action="delete2.php" method="post">
<?php
while($row = mysql_fetch_array($result))
{
?>
<input type="checkbox" name="c[]" value="<?php echo $row["id"] ?>"/>
<?php
echo $row["fname"] . " " . $row["lname"] . "<br/>";
}
?>
<input type="submit" value="Delete Customer"/>
</form>
<?php
mysql_close($con);
?>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$con = mysql_connect("localhost:3306", "root", "");
mysql_select_db("dvdclub", $con);
if(isset($_POST["c"]))
{
$value = $_POST["c"];
$n = count($value);
for($i = 0; $i < $n; $i++)
{
mysql_query("delete from customer where id = '$value[$i]'");
echo "Delete successfull <br/>";
}
?>
<meta http-equiv="refresh" content="2; url=index.php"/>
<?php
}
else
{
echo "please select at least one customer";
?>
<meta http-equiv="refresh" content="2; url=delete1.php"/>
<?php
}
mysql_close($con);
?>
</body>
</html>
No comments
Post a Comment