Jump to content

Creating a search form


jirble2

Recommended Posts

If you want the search query to run only if something has been entered, all you need to do is check that the field isn't empty after trimming whitespace.

 

$_POST['search_term'] = trim($_POST['search_term']);
if( empty($_POST['search_term']) ) {
     // allow the query to run
} else {
     // don't allow the query to run, display error, or send back to search form, etc.
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.