我想知道为什么这段代码不起作用?该按钮执行正确的确认序列,但实际上并未删除记录。我从一个工作按钮复制并粘贴了代码,我认为在传输中我错过了指定细节?
if (isset($_GET['deleteseries'])) {
echo 'Do you really want to delete '
. $_GET['series']
. '? <a href="editstock.php?yesdelete='
. $_GET['id']
. '">Yes</a> | <a href="editstock.php">No</a>';
exit();
}
if (isset($_GET['yesdelete'])) {
$deleteSQL = sprintf("DELETE FROM series WHERE id='%s' LIMIT 1",
GetSQLValueString($_GET['yesdelete'], "int"));
mysql_select_db($database_connectmysql, $connectmysql);
$Result1 = mysql_query($deleteSQL, $connectmysql) or die(mysql_error());
header("location: editstock.php");
exit();
}
使用此按钮:
<input name="deleteseries"
type="button" id="deleteseries"
value="delete"
style="width:20%; float:right"
onclick="window.location.href = '?deleteseries=delete&id=<?php echo $row_seriesrecordset['id']; ?>&series=<?php echo $row_seriesrecordset['series']; ?>'"/>