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
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?"
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
if you have PHP installed create a file called dropdown.php and include
In the appropriate section of your pagesCode:<?php include ("dropdown.php"); ?>
Bob
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?"
I think the easiest way of doing it is to create an options.csv file in the format:
then in your main Html page include these lines:Code:option1,optionvalue1 option2,optionvalue2 option3,optionvalue3
Then simply edit the csv file using word pad or excelHTML 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>
Bob
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?"
assuming you do not have a few thousand options it should take less time than it would take to load a small gif.
Bob
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks