changing day of the month
Posted: Sun Oct 22, 2006 11:09 pm
i have a calendar with two hyperlinks in it. one takes you to the next month, the other to the previous month. the code below performs this function but when it comes to changing the name of the month ('F') it ony returns a useless integer value.
how do i get it so it changes the string name of the current month and how do i make the top line to read "if no post value for 'month' was passed"? so it looks neater. i tried but it didn't work
thanks in advance!
garry
Code: Select all
$month = $_GET['month'];
$month_name = $_GET['month_name'];
if ($month == '')
{
$month = date("m");
$month_name = date("F");
}
if ($month > 1)
$prevm = sprintf ( ' <a href="?month=%s&month_name=%s&year=%s" ><<</a> ', $month - 1, $month_name - 1, $year );
else //If it is January our prev link will be December of the previous year
$prevm = sprintf ( ' <a href = "?month=%s&month_name=%s&year=%s" ><<</a> ' , 12, $month_name - 1, $year - 1 );
if ($month < 12)
$nextm = sprintf ( ' <a href="?month=%s&month_name=%s&year=%s" >>></a>', $month + 1, $month_name + 1, $year );
else //if it is December our next link will be January of the next year
$nextm = sprintf( ' <a href="?month=%s&month_name=%s&year=%s" >>></a>', 1, $month_name + 1, $year + 1 );how do i get it so it changes the string name of the current month and how do i make the top line to read "if no post value for 'month' was passed"? so it looks neater. i tried
Code: Select all
if (!$_POST['month'])thanks in advance!
garry