<?php
$qr_topic = @mysql_query("SELECT * FROM topics");
while ($topic = @mysql_fetch_array($qr_topic)) {
$highlight = "";
**if ($topic['name'] == $_GET['topic'] || $post['topic_id'] == $topic['id']) {**
$highlight = "class='highlight'";
}
echo "<li ".$highlight."><a href='index.php?topic=".$topic['name']."'>".$topic['name']."<img src='img/".$topic['image']."' width='195' height='90' /></a></li>";
}
?>
获取未定义的索引错误,不确定是什么问题?这可能是错误的一行。 if($ topic ['name'] == $ _GET ['topic'] || $ post ['topic_id'] == $ topic ['id']){**
答案 0 :(得分:0)
您尝试使用$ _GET ['topic']而不检查它是否存在,这就是您收到该错误的原因。我建议你先使用is_set()或empty()来测试变量是否存在。