get categories
-
I am developing a course booking system.
There are four dropdown boxes per page
Each course is available on certain dates and I have used categories as a means of identifying those dates.
On selecting the course some javascript opens up a dropdown list of available weeks.This all works fineOn the edit page we use a version of the dropdown list so prospects can change the date.
If only one course booked everything works well but on the second and subsequent course bookings – the drop down list of dates has multiple entries.everything is driven by session variable at this stage
‘<input type=”hidden” name= “course1a” value=”<?php echo $crs1a;?>,<?php echo the_field(‘cost_of_course’,$id1); ?>” />
<select name=”date1a” id=”date1a”>
<?php if($id1==”){?>
<option value=””>Select Week</option>
<?php } else{ ?>
<option selected=”selected” value=”<?=$date1a?>”><?=$date1a?></option>
<?php } ?><?php
$categories =get_the_category($id1);
foreach ($categories as $category) {if($category->name !== ‘6 +’)
if($category->name !== ‘7+’)
if($category->name !== ‘8+’)
if($category->name !== ‘9+’)
if($category->name !== ’10 +’)
if($category->name !== ’11+’)
if($category->name !== ‘All’)$option = ‘<option value=”‘.$category->cat_name.'”>’;
$option .= $category->cat_name;
$option .= ‘</option>’;
echo $option;
}
?>’
Each course has a version of this (it was the simplest way I could think of to effect it).
Any thoughts as to what is going on?
- The topic ‘get categories’ is closed to new replies.