Search multiple fields

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 21, 2012   (RSS)

Re: [benedict] Search multiple fields

By benedict - March 20, 2012

Any word guys?

Re: [benedict] Search multiple fields

By (Deleted User) - March 20, 2012

Hi benedict,

When the form submits it sends all the post data to products_search.php which then uses that data to limit the records it loads for display.

At the top of products_search.php you should have something like:

if ( @$_REQUEST['supplier_barcode, code, description_keyword'] != '' ) {
// load records
list($records, $recordsMetaData) = getRecords(array(
'tableName' => {the table},
'perPage' => {the number of results per page, if desired},
));
}


I've added the if statement in case you want to display a message about not having entered any search criteria.

You can then manipulate the returned results as you need to.

Hope this helps,

Tom

Re: [Tom P] Search multiple fields

By benedict - March 20, 2012

Thanks Tom - I'm aware of that.

I found the issue - I had spaces in the name of the search box.

Should have been:


<input class="searcharea" name="supplier_barcode,code,description_keyword" type="text" value="Product Search"/>

Re: [benedict] Search multiple fields

By (Deleted User) - March 21, 2012

Hi benedict,

I needed more coffee yesterday it seems!

Good catch.

Tom