<?php header("content-type:text/html;charset=utf-8"); include_once 'dbio/NewsTypes.php'; include_once 'dbio/NewsArticles.php'; //获得表单提交的数据 $searchType = $_POST["searchType"]; $keyword = $_POST["keyword"]; //开始查询数据库,搜索 $newsInfo = array(); if ($searchType != NULL) { $newsInfo = NewsArticles::searchNews($searchType, $keyword); } $newsTypes = NewsTypes::getNewsTypes(); //所有分类 ?> <html> <head> <title>天天新闻网</title> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <link href="css/news.css" type="text/css" rel="stylesheet" /> <script type="text/javascript"> function checkSearch() { if(document.frm.keyword.value == "") { alert("搜索关键字不能为空!"); document.frm.keyword.focus(); return false; } }