mardi 14 avril 2015

How to distinguish between search or browse function?

I've got a database with a couple of thousands entries. So I need a page to make some a simple search. I've been fiddling around with a simple form and search field, but I can't wrap my head around to distinguish wether a user has submitted a search query or pressed the browse button.


This is my simple HTML:



<form action="index.php" method="get">
<input autofocus name="query" placeholder="Enter your search here..." type="search" />
<button name="browse">Browse</button>
</form>


The question is how do I distinguish if the user has entered a search query and wants to search the database, or has pressed the browse button to browse the database?


Do you need to change my HTML/Form, or is there any neat PHP trick to distinguish between the search or browse function?


Aucun commentaire:

Enregistrer un commentaire