我有一个带有一些复选框的页面,如果只选择一个复选框,它工作正常,但是如果我选择 2 个或更多复选框,结果显示正常,但脚本切断后页面的其余部分。任何想法会导致这种情况发生。
<?php
if (isset($_POST['criteria']) && !empty($_POST['criteria'])) {
foreach($_POST['criteria'] as $key => $value) {
// get the function
include ($_SERVER['DOCUMENT_ROOT'] . '/scripts/pagination-functions.php');
$page = (int)(!isset($_GET["page"]) ? 1 : $_GET["page"]);
$limit = 14;
$startpoint = ($page * $limit) - $limit;
// Runs mysql_real_escape_string() on every value encountered.
$clean_criteria = array_map('mysql_real_escape_string', $_REQUEST['criteria']);
// Convert the array into a string.
$criteria = implode("','", $clean_criteria);
// to make pagination
$statement = "table WHERE page IN ('$criteria') ORDER BY long_title ASC";
if (!$query = mysql_query("SELECT * FROM {$statement} LIMIT {$startpoint} , {$limit}")) {
echo "Cannot parse query";
}
elseif (mysql_num_rows($query) == 0) {
echo "No records found";
}
else {
echo "";
while ($row = mysql_fetch_assoc($query)) {
echo "" . $row['name'] . "<br />
" . $row['description'] . "";
}
}
echo "<div class=\"pagination\">";
echo pagination($statement, $limit, $page);
echo "</div>";
}
}
?>
如果有人可以提供帮助或指出正确的方向,我将非常感激