Creating a searchable list

Discussion in 'Web Design and Development' started by irishgrizzly, Nov 19, 2009.

  1. irishgrizzly macrumors 65816


    May 15, 2006
    I have to create a searchable list on a web page. The list is of 400 locations and there status eg;

    Dublin 44
    Paris 66
    London 77

    The the query would be;

    dublin = Dublin 44
    Tokyo = no entry for tokyo

    What's the best way to do this Java or something else?

    edit, people have suggested creating a database, but the site and budget are so small it wouldn't make sense.

    How would I go about creating a series of drop down menus that open up new options depending on the last input eg;

    1st menu


    2nd menu


    2nd menu
  2. angelwatt Moderator emeritus


    Aug 16, 2005
    Is the data dynamic? For instance, is Dublin 44 sometimes Dublin 33?

    Doing things by database wouldn't be much more work than any other way you'd do it. If you want to look at a DB option, look at SQLite. I've been using it some lately and its nice because it just stores the data in a single file you can move just like any file. PHP has built-in functions for interacting with it. You'd simply want to make sure the web host offers support for it.

    For doing lists and sub-lists, that would have to be done via JavaScript. Well, I suppose you could do it server side, but that would require a page load for each change so isn't a great experience for the user. Also though, depending on your requirements, doing it via JavaScript would reduce accessibility. There's a few tutorials for doing this with JavaScript. Apple uses it too on their web site.

    Searching amongst data could be done with JavaScript as well, and how hard it would be to do depends on how robust you need it to be. It's easy enough to find a given string inside another and ignore case, but if you need something that can handle small spelling errors it would be more involved. Doing the search can be done with JavaScript alone if the data is static (and potentially with dynamic data with the help of PHP). For dynamic data though, you would likely try AJAX to get the newest data from the server to populate the lists and even potentially do the search.

    There's some thoughts for you to consider. The biggest need to know though is whether or not the data is dynamic.

Share This Page