运行搜索,以更新其他页面上的表 [英] Running a search, to update a table on a different page

查看:73
本文介绍了运行搜索,以更新其他页面上的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我将直接讲到这里,基本上,我试图在索引页面上使用PHP运行搜索,当我在搜索框中输入内容后按ENTER键时,我需要显示另一个页面,表中的搜索结果.

区别在于,带有表的页面已使用PHP小型MYSQL查询加载了其中的信息.

有没有办法使之成为可能???

评论和答案非常感激.
问候,

Tom.

Hi everyone,

I''ll just go straight to the point here, basically I''m trying to run a search using PHP on my index page, and when I press ENTER after typing in the search box, I need a different page to appear, with the results of the search in a table.

The difference is, the page with the table already loads with information in it from a small MYSQL query with PHP.

Is there a way to make it possible????

Comments and answers are much appreciated.
Regards,

Tom.

推荐答案

在表单中,将ACTION更改为表所在的页面,然后将METHOD更改为GET而不是post.
In the form, change ACTION to the page thaT the table is on, and change the METHOD to GET rather than post.


在用户输入搜索查询后,我将使用javascript重定向该页面

window.location.href ="//secondpage.php?search = searchvalue";

然后在页面的服务器端,我将检查查询字符串搜索是否具有值

如果查询字符串搜索具有价值,则不要运行您的小型MySQL查询,而是运行您的搜索查询

否则,如果查询字符串搜索变量没有值,则运行您的小型MySQL查询
i would redirect that page with javascript after a user enters their search query

window.location.href="//secondpage.php?search=searchvalue";

then on the server side of the page i would check if the query string search has a value

if query string search has value then do not run your small MySQL query and run you search query instead

else if query string search variable does not have a value then run your small MySQL query


这篇关于运行搜索,以更新其他页面上的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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