• Notice regarding image hosts and attachments. See here.

Creating Dynamic lists php

Permabanned
Joined
25 Oct 2004
Posts
9,078
Hiya folks

Looking for a method to create a dynamic list in php.

Essentially i will have 2-3 lists, a primary list which will contain the "headers" followed by sub category lists.

What im looking for is a method where i can have a list of headers and when someone clicks on one of the options, i would populate another list with its appropriate sub category items.

IE

Header1 |
Header2 -> Selected | Sub Category1 Header 2
Header3 | Sub Category2 Header 2
| Sub Category3 Header 2

Hope that gives you an idea what im looking to do.
 
Sounds like you are looking for a way to present a hierarchical/tree structure as a navigation page element.

I don't know how advanced your PHP skills are but you might look at Zend_Navigation component from the Zend Framework. You don't need to use the whole framework, most of the components are "use at will".
 
You want a drill down list basically.
If this was single selects per 'level' I'd do this by presenting the root level in a <select> list on the page then add an 'onchange' call to a JavaScript function which uses AJAX to call a php page passing the chosen parent ID. This page would get the sub levels from the db and load a new <select> box with the values. The output is returned to the AJAX JS function and you can drop it into a waiting DIV container on your page. With a bit of tweaking to the JS function, you can repeat for multiple 'levels' in the heirarchy.
 
Drill down looks like what im after, but I cant use jQuery as it conflicts with the sites existing prototype libraries and I have no way of getting to work via noConflict in jQuery.

So if anyone knows of a Drilldown menu that uses prototype that would be great.
 
Back
Top Bottom