I need to create a form with five dropdown select lists. Making a selection in any list will cause the other lists to repopulate. It's fine if the page refreshes in order to repopulate the lists, although eventually I'd love to have it happen dynamically (using Ajax or JQerry). The development environment I am working in (and learning) is PHP.
It needs to function in the same way as the form found here. I have been provided with the dataset used by that form. (I receive the data as an XML feed, which I populate an MySQL db with).
You'll see there are five dropdown select list fields.
- Cruise Line
- Destination
- Ship
- Cruise Length
- Sailing Date
Each of these requests its data from the tables in the underlying MySQL database. Changing any field will refresh the page, and repopulate every other field with filtered data.
Selecting Ship
, for instance, will cause all the other fields to change accordingly, such that they only display options related to that Ship. Selecting Sailing Date
will cause all fields to change so all other fields will only show data related to that date, and so on.
For those who have the knack and inclination to make some suggested code examples, here's some info on the database structure.
Primary tables and their relationships: (primary key on each table is id
, therefore, for example, a foreign key reference to ships
will use foreign key ships_id
)
cruiselines
destinations
ships
(foreign keys:cruiselines_id
,cruisetype_id
)cruises
(foreign keys:cruiselines_id
,destination_id
,ship_id
,cruisetype_id
; also haslength
field use for theCruise Length
selector)sailingdates
(foreign key:cruise_id
)-
cruisetypes
I am sure there must be some working examples and info on this kind of scenario, but after a few hours of searching the only thing I turned up that was close, was this post on Daniweb. The issue may be that I really don't know how to refer to what I am trying to achieve.
Any suggestions on examples of this elsewhere, or here on Daniweb, or whatever assistence you can provide would be greatly appreciated.
I am essentially a beginner with PHP, and completely new to JQuery and Ajax, but very keen to learn, and a fast learner (I have 28 years of professional IT experience, so I am reasonably proficient with picking up new technologies).