- This topic is empty.
September 18, 2009 at 4:30 pm #26169Filmguy15Member
This is my first post on this site. I love the articles, they are very helpful.
The attachment is a screenshot of a small section of a site I am working on. I don’t have a live version, otherwise I would post it. Here is what I want it to do….
1. When the user inputs their zip code and hits enter, I want it to search through a mysql database that I have created, looking for entries with that zip code.
2. I then want it to list those entries in the right-hand column. I would think it would need to create a div or li item for each entry.
That is the basic functionality that I am looking for. Eventually I would like to have this process animated with jQuery, where the results update as the user types (similar to Spotlight). That isn’t as important right now though.
I’ve searched quite a bit and I can’t seem to find anything that works. Any help would be appreciated!
-ChaseSeptember 18, 2009 at 6:12 pm #64384falkencreativeMember
Probably the simplest way to handle this would be to have the page display no entries by default. User would input a zip code, press a button to submit the form, and the page would be reloaded with the results of the search.
Sounds like the PHP to perform that search shouldn’t be all that complicated. As you say, just search your database for all entries that match the zip code (which you could get by using $_GET or $_POST), and display them. Remember to validate the data that the user enters — make sure it is numeric and is the correct # of characters long to avoid errors.
This might get you started: http://www.tizag.com/mysqlTutorial/mysqlwhere.phpSeptember 20, 2009 at 10:57 am #64447Filmguy15Member
Thanks for the reply! In case anyone is interested, I found this excellent tutorial:
It is for an apple.com inspired search box, but I was able to modify it (heavily) to suit my needs.
- The forum ‘Back End’ is closed to new topics and replies.