Re: [kcmedia] Post Code Search
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/