Basic Search

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 6, 2009   (RSS)

By _kate_ - June 30, 2009 - edited: June 30, 2009

Hi,
Trying to create a standard search box for a site using the help guide yet having no luck. Here's what I have so far....

SEARCH FORM
<form method="POST" action="search.php">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="162" valign="middle"><label><input type="text" name="title" value="" class="search"></label></td>
<td width="34" valign="middle"><label>
<input type="image" name="submit" id="GO2" value="Search" src="imgs/go.jpg" />
</label></td>
</tr>
</table>
</form>


RESULTS PAGE
<?php
require_once "/mysiteaddy/viewer_functions.php";

list($jewelleryRecords, $jewelleryMetaData) = getRecords(array(
'tableName' => "jewellery",
));

list($products_lea_steinRecords, $products_lea_steinMetaData) = getRecords(array(
'tableName' => "products_lea_stein",
));

list($products_vintage_jewelleryRecords, $products_vintage_jewelleryMetaData) = getRecords(array(
'tableName' => "products_vintage_jewellery",
));

list($products_gentlemensRecords, $products_gentlemensMetaData) = getRecords(array(
'tableName' => "products_gentlemens",
));

list($products_decorativeRecords, $products_decorativeMetaData) = getRecords(array(
'tableName' => "products_decorative",
));

list($products_collectiblesRecords, $products_collectiblesMetaData) = getRecords(array(
'tableName' => "products_collectibles",
));

list($products_sewingRecords, $products_sewingMetaData) = getRecords(array(
'tableName' => "products_sewing",
));

?>

Re: [ross] Basic Search

By _kate_ - July 3, 2009

Haha sorry probably should have included that!!

The site has products on it - I just want it to search the product name field. Don't know if it will be a problem that the products are all in different sections?

Anyway when you hit search with nothing typed in, it merely shows all the products from the first section listed (jewellery). If you type any word in at all it will say no products to display, even if you use a word that is in the title of an item

Re: [_kate_] Basic Search

By ross - July 6, 2009

Hi Kate

Thanks for the additional details :).

The first thing I would check is the name of that field you are using for the textbox on your form. It's called "title". That means, it's going to search in the title field of each section.

Now, the next thing here is that you have a different viewer for each of your sections. There will be some extra work to get all that dumped into a single list of results.

What I think you'll want to do instead is take a look at this post:


http://www.interactivetools.com/forum/gforum.cgi?post=61466#61466


That will go over a better option for searching in multiple sections.

Have a look and let me know what you think :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/