On a site I did recently, I created a dropdown box with a list of months that a user could select to filter by month.
*This isn't done with ajax so might not be of use*
http://www.connect-elim.org.uk/index...tml?day=201011
Don't know if this will be of any help to you
Code:
<?php
if (isset($_GET['month'])) {
$month = $_GET['month'];
$year = $_GET['year'];
header("Location: /index.php/calendar.html?day=$year$month");
exit;
} else {
?>
<div class="caldropdown">
<form method="get" action="<?php echo $PHP_SELF;?>" id="dateselect">
<?php
$viewingmonth = substr($_GET['day'], 4, 2);
$months = array ('', 'January', 'February', 'March', 'April', 'May', 'June','July', 'August', 'September', 'October', 'November', 'December');
$monthnum = array ('', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
$monthrange = range (1, 12);
$weekday = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
$currentMonth = date('m');
$currentYear = date('Y');
$next2years = date('Y')+2;
$years = range ($currentYear, $next2years);
$i = 0;
echo "Month: <select name='month'>";
foreach ($monthrange as $value) {
if($monthnum[$value] == $viewingmonth && $i == 0):
$default = ' selected="yes"';
$i++;
elseif ($monthnum[$value] == $currentMonth && $i == 0):
$default = ' selected="yes"';
else:
$default = '';
endif;
echo '<option'.$default.' value="'.$monthnum[$value].'">'.$months[$value].'</option>\n';
}
echo '</select>';
echo " Year: <select name='year'>";
foreach ($years as $value) {
if($value == $currentYear):
$default = ' selected="yes"';
else: $default = '';
endif;
echo '<option '.$default.' value="'.$value.'">'.$value.'</option>\n';
}
?>
<input type="submit" value="View" />
</form>
</div>
<?php } ?>
It's could probably do with some editing as I'm no pro at coding but it works for me ok.
Bookmarks