Populating search form with events' custom fields
-
Hi,
I am building a drop down filter to allow users to filter events based on custom fields (event_owner, event_start_date, etc), but for some reason it is not working properly (values do not seem to be populated). Could you let me know what may be the problem? Here is the code i am using:
<form name="search" action="" method="get"> <select name="EventName"> <?php $metakey = 'event_name'; $EventNames = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->posts.post_type = 'events' WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) ); if ($EventNames) { foreach ($EventNames as $EventName) { echo "<option value=\"" . $EventName . "\">" . $EventName . "</option>"; } } ?> </select> <input type="submit" value="search" /> </form>
FYI – I have looked at the tutorial (“style”) available on your website, but it is slightly different and does not address my question.
As usual, many thanks for all your help and time!
Best,
Yvan
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Populating search form with events' custom fields’ is closed to new replies.