已经为此忙碌了一段时间,但在删除一行后仍然无法重新加载页面。
行删除工作正常,但仅在我重新加载页面后才会出现。一直在移动一些代码以在按下提交时读取它,但没有运气。有任何想法吗 ?
<?php
mysql_connect("localhost", "root", "") or die(mysql_error()) ;
mysql_select_db("booking") or die(mysql_error()) ;
$resultselect = mysql_query("SELECT * FROM test_mysql ") or die(mysql_error());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>row delete</title>
<link rel="stylesheet" type="text/css" href="" />
</head>
<body>
<?php
if(isset($_POST['done'])){
$done = implode(',', $_POST['done']);
$deletequery = "DELETE FROM test_mysql WHERE id IN ($done)";
$resultdelete = mysql_query($deletequery) or die(mysql_error());
}
?>
<form method="post" action="">
<?php while($row = mysql_fetch_array($resultselect)){?>
<input type="checkbox" name="done[]"
id="<?php echo $row['id'] ?>"
value="<?php echo $row['id'] ?>">
<label for="<?php echo $row['id'] ?>">
<?php echo $row['name'] . ' ' . $row['lastname']. ' '.$row['email']; ?>
</label>
<br />
<?php } ?>
<input type ="submit" value ="submit">
</form>
<?php
if($resultdelete) {
echo 'Item(s) deleted from list.';
}
?>
<pre>
<?php print_r($_POST) ?>
</pre>
</body>
</html>