将搜索查询结果回显到另一个html页面
问题描述:
我怎样才能将搜索查询结果回显到另一个页面..我知道你必须将它保存在$ _session然后将它标题出来但我可以弄清楚..请帮助我!搜索栏将位于我的页面顶部..这会修复确认表单重新提交提示吗?
how can i echo out the search query results to another page.. I know you have to save it in $_session then header it out but i can figure it out.. help me please! the search bar would be on top of my page.. and would this fix the "Confirm Form Resubmission" prompt?
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$search_output = "";
if(isset($_POST['searchquery']) && $_POST['searchquery'] != ""){
$searchquery = preg_replace('#[^a-z 0-9?!]#i', '', $_POST['searchquery']);
{
$sqlCommand = "(SELECT id, links, page_body, page_title AS title FROM pages WHERE MATCH(page_title,page_body) AGAINST ('$searchquery'))";
}
include_once("db_connects.php");
$query = mysql_query($sqlCommand) or die(mysql_error());
$count = mysql_num_rows($query);
if($count > 1){
$search_output .= "<hr />$count results for $searchquery<hr />";
while($row = mysql_fetch_array($query)){
$id = $row["id"];
$title = $row["title"];
$link = $row["links"];
$body = $row["page_body"];
$search_output .= "<a href='".$link."'>".$title."</a> - $body<br>";
} // close while
} else {
$search_output = "<hr />0 results for $searchquery<hr />";
}
}
?>
答
_session然后将其标题出来,但我能弄清楚..请帮助我!搜索栏将位于我的页面顶部..这会修复确认表单重新提交提示吗?
_session then header it out but i can figure it out.. help me please! the search bar would be on top of my page.. and would this fix the "Confirm Form Resubmission" prompt?
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
search_output = ;
if(isset(
search_output = ""; if(isset(
_POST [' searchquery'])&&
_POST['searchquery']) &&