Simple Search: Passing Form Variable to URI Using CodeIgniter

前端 未结 5 1204
旧巷少年郎
旧巷少年郎 2021-02-06 17:49

I have a search form on each of my pages. If I use form helper, it defaults to $_POST. I\'d like the search term to show up in the URI:

http://examp         


        
5条回答
  •  粉色の甜心
    2021-02-06 18:09

    I don't know much about CodeIgniter, but it's PHP, so shouldn't $_GET still be available to you? You could format your URL the same way Google does: mysite.com/search?q=KEYWORD and pull the data out with $_GET['q'].

    Besides, a search form seems like a bad place to use POST; GET is bookmarkable and doesn't imply that something is changing server-side.

提交回复
热议问题