Post Code Search

5 posts by 2 authors in: Forums > CMS Builder
Last Post: December 6, 2010   (RSS)

By KCMedia - December 5, 2010

Hi

I have setup a multi section in CMS Builder with all the fields that are needed for the search but now i need some help as to how to get a search working and to display the results.

I have attached the main search page and also the results page i want to be able to have users search for a post code and then it will display any matching results for that post code.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Post Code Search

By Jason - December 6, 2010

Hi Craig,

There are a couple things you'll need to change. First, on your search page, you'll want to give your text field the same name as the field in the database. In this example, the field in probably called "post_code" but you can change this if necessary:

<form action="postcode-searchResults.php" method="POST">
<p>
<input name="post_code" type="text" id="Pcode" />
</p>
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label>
<label>
<input type="reset" name="button2" id="button2" value="Reset" />
</label>
</form>


Next, on postcode-searchResults.php, you'll need to change your query. You're not going to want to use whereRecordNumberInUrl(1) and you're not going to want to set you're limit to 1 if you want to display all results. Try this instead:
// load records
list($post_code_searchRecords, $post_code_searchMetaData) = getRecords(array(
'tableName' => 'post_code_search',

));


The variable $post_code_searchRecords will be an array with all the records from post_code_search where the field "post_code" is equal to the value typed in the text box.

Give this a try and let me know if you run into any problems.

Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Post Code Search

By KCMedia - December 6, 2010

hi Jason

I sort of got it working

If i search for a post code say 2234 it will show just one result but i know that there are more results than just that why is it only showing 1 result.

here is the link to the site page http://www.afft.com.au/newsite/postcode-search.php

and also the page codes for each page.

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [Jason] Post Code Search

By KCMedia - December 6, 2010

Hi Jason

thanks for that works great now.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz