我有一个莫名其妙的 IE8 PHP 问题。下面的代码在 chrome 和 FF 中运行良好,但在 IE8 中运行良好。表单正在提交,如果没有选择搜索词或复选框,则会显示错误,如果两个 db 搜索都失败,则会显示 No Actors 和 No Movies found 回声。但是,如果其中一个搜索成功,则不会显示任何内容,甚至演员/电影也没有找到让我难过的回声。
这是代码:
<?php
if($_POST[submitbutton]){
$search = trim(mysql_real_escape_string($_POST[search]));
if(!$search){
echo "Please enter a search term!";
}else if(!$_POST['checkbox']){
echo "Please select at least one database to search!";
}else{
//search names
if(in_array("actors", $_POST['checkbox'])){
$query = mysql_query("SELECT name_id, realname, mainalias FROM names WHERE realname LIKE '%$search%' OR mainalias LIKE '%$search%'");
if(mysql_num_rows($query)==0){
echo "<h2>No Actors by that name found!</h2>", "<p>";
}else{
echo "<h2>Actors Found:</h2>";
while ($record = mysql_fetch_assoc($query)){
$realname = $record['realname'];
$name_id = $record['name_id'];
echo "<a href='index.php?page=name&id=$name_id'>", $realname, "</a><hr>";
}
}
}
//search titles
if(in_array("movies", $_POST['checkbox'])){
$query = mysql_query("SELECT title_id, title FROM titles WHERE title LIKE '%$search%'");
if(mysql_num_rows($query)==0){
echo "<h2>No Movies by that name found!</h2>", "<p>";
}else{
echo "<h2>Movies Found:</h2>";
while ($record = mysql_fetch_assoc($query)){
$title = $record['title'];
$title_id = $record['title_id'];
echo "<a href='index.php?page=title&id=$title_id'>", $title, "</a><br>";
echo "<hr>";
}
}
}
}
} //end post submitbutton
?>