Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Need help with a PHP search form…

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26169
    Filmguy15
    Member

    Hello,

    This is my first post on this site. I love the articles, they are very helpful.
    [attachment=0]Picture 3.png[/attachment]

    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!

    -Chase

    #64384

    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.php

    #64447
    Filmguy15
    Member

    Thanks for the reply! In case anyone is interested, I found this excellent tutorial:

    http://www.marcofolio.net/webdesign/a_fancy_apple.com-style_search_suggestion.html

    It is for an apple.com inspired search box, but I was able to modify it (heavily) to suit my needs.

    Thanks again!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.