help on building a basic php search engine

亡梦爱人 提交于 2019-11-29 15:33:14

i have no idea how to make the three functionalities(pagination, sorting and filtering) work together...want I want to achieve

GET submits are a bit different than POST submits, since you pass all of your variables in one shot with the submit INPUT.

So to pass the same data properly with a GET submit, you will need to pass each variable in the A HREF link.

To build this, try something like this:

$URLsubmit=(TheSubmitURL).'?';
foreach ($submit_data as $key => $value)
  {
  $URLsubmit.=$key.'='.$value.'&';
  }
$URLsubmit = substr($URLsubmit,0,strlen($URLsubmit)-1); // remove last '&'

Naturally you will want to scrub the data URL friendly and create counters to increment pagination with each A HREF page link.

echo '<A HREF="'.$URLsubmit.'">';

Hopefully that will point you in the right direction.

BTW, using $_SESSION the way you are using it is a big security risk, unless you set a session cookie and use XSRF validation.

correct me if I'm wrong. But one way of doing it would be to set your filter in a GET variable

Then you can a standalone PHP solution and javascript coming in a bit later.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!