I am building a tour company website and I'm using a custom post type called "Tours" which has a number of custom fields associated with it.
One of the custom fileds is used to store multiple "Departure Dates" associated with the tour. I'm using the Deluxe Blog Tips Meta Box script which allows you to clone a custom fields (in the backend) thus creating an array of values associated with the one custom field. For example I am currently outputting these values as follows in the template:
$metas = get_post_meta( get_the_ID(), 'tour_dates', true );
foreach ( $metas as $meta )
{ echo $meta; }
This Outputs a simple list of dates (or what ever is added in the custom field) such as:
29th September 2012
15th October 2012
23rd November 2012
What I am wanting to do is put a simple pre-booking form at the bottom of the tour page. On this form I want users to be able to select a tour date they want to book.
Finally the question:
Is it possible to dynamically populate a Radio Button list with the various departure dates (any value) coming from an array of values stored in a single custom field?
Ideally the form will have a hidden field populated by the post title (that bits easy) and the pre populated radio button list (thats where I am stuck!!) for the user to select the dates that suit them.
If this is possible I'll simply pass the Page Title & The Selected Departure Date to a generic booking form, (on another page) where the client can fill out all their contact details ect, and keep the main tour page simple.
Would be great to hear if this is possible and if anyone has done anything similar.