Results 1 to 8 of 8

 

Thread: DropDown Lists

  1. #1
    Registered User

    Status
    Offline
    Join Date
    Feb 2004
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts


    Hi all,
    I have many drop down/selection lists that need constant updating. These lists are used on a number of different pages. Is there a way to create a master list that can be modified in one file that can be used on different pages? Seems simple enough??

    Thanks in advance...
    "Is that a Mexican poncho or is that a Sears poncho?"

  2. #2
    Registered User

    Status
    Offline
    Join Date
    Dec 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could hold your categories in a database and dynamically create your drop down lists. Ask your hosting company if you have a database and scripting in your plan.

    Danny

  3. #3
    Registered User

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Gillingham
    Posts
    510
    Thanks
    0
    Thanked 4 Times in 1 Post
    if you have PHP installed create a file called dropdown.php and include

    Code:
    <?php
    include ("dropdown.php");
    ?>
    In the appropriate section of your pages

    Bob

  4. #4
    Registered User

    Status
    Offline
    Join Date
    Feb 2004
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes I do have php, so

    <?php
    include ("dropdownlist1.php");
    include ("dropdownlist2.php");
    include ("dropdownlist3.php");
    .
    .
    .
    .
    ?>

    Then how do I include the "option value" values in the list?
    "Is that a Mexican poncho or is that a Sears poncho?"

  5. #5
    Registered User

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Gillingham
    Posts
    510
    Thanks
    0
    Thanked 4 Times in 1 Post
    I think the easiest way of doing it is to create an options.csv file in the format:

    Code:
    option1,optionvalue1
    option2,optionvalue2
    option3,optionvalue3
    then in your main Html page include these lines:

    HTML Code:
    <form>
    <select>
    <?php 
    $fp= fopen("options.csv","r");
    while ($data=fgetcsv($fp,1000,",")){
    echo "<option value='$data[1]'>$data[0]</option>\n";
    }
    fclose($fp);
    ?>
    </select>
    </form>
    Then simply edit the csv file using word pad or excel

    Bob

  6. #6
    Registered User

    Status
    Offline
    Join Date
    Feb 2004
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Then everytime the page loads, I do a fopen? What will that do to my page loading time?
    "Is that a Mexican poncho or is that a Sears poncho?"

  7. #7
    Registered User

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Gillingham
    Posts
    510
    Thanks
    0
    Thanked 4 Times in 1 Post
    assuming you do not have a few thousand options it should take less time than it would take to load a small gif.

    Bob

  8. #8
    Tom
    Registered User

    Status
    Offline
    Join Date
    May 2005
    Posts
    238
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Yeah wouldn't take too long to load. I normally just hold the values in an array in a central common.inc.php kind of file, then dynamically create the list wherever I want it. This is also better than storing them as static HTML as you can preset fields on a form against the value stored in the $_GET or $_POST variables.
    Websites for Sale - Browse sites for sale and place an ad for free.
    Social Shopping - Join our affiliate program



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 07-06-06, 01:04 PM
  2. Help needed with javascript dropdown lists
    By MobileDealsNow in forum Programming
    Replies: 4
    Last Post: 02-10-05, 02:49 PM
  3. Email lists for Butlins
    By mkyrklund in forum Affiliate Marketing Lounge
    Replies: 0
    Last Post: 21-10-04, 04:09 PM
  4. Affiliates with mailing lists
    By rufus in forum Affiliate Future
    Replies: 0
    Last Post: 05-05-04, 06:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2