将搜索查询结果回显到另一个html页面 [英] echo search query results to another html page

查看:227
本文介绍了将搜索查询结果回显到另一个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']) &&


这篇关于将搜索查询结果回显到另一个html页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆