Php wrote a Calendar, but not when it comes to cross-year!

$date = strtotime(date("Y-m-d"));

        $day = date("d", $date);
        $month = str_pad($_GET["m"],2,"0",STR_PAD_LEFT);
        $year = date("Y", $date);
        $firstDay = mktime(0,0,0,$month, 1, $year);
        $title = strftime("%m", $firstDay);
        $dayOfWeek = date("D", $firstDay);
        $daysInMonth = cal_days_in_month(0, $month, $year);
        $timestamp = strtotime("next Sunday");
        $weekDays = array("", "", "", "", "", "", "");
        for ($i = 0; $i < 7; $iPP){
          $timestamp = strtotime("+1 day", $timestamp);
        }
        $blank = date("w", strtotime("{$year}-{$month}-01"));
        
<td><?if($_GET["m"]!="01"){?><a class="monthLink" href="?m=<?=str_pad($month-1,2,"0",STR_PAD_LEFT);?>&y=<?=$year;?>&region=<?=$_GET["region"];?>"> <?=$month-1;?></a><?}?></td>

I use or to select a month
, but in January it will become 00 month
if he can start in December of the previous year?
and starting in January of the following year? There will be no mistakes

Mar.07,2021

when I first heard of using php as a date selector, it was really bad to choose a date by clicking on a link.

The problem of

month is easy to deal with. When you click on the previous month in January, you subtract the current year by 1, and the month becomes 12

.

by the same token, when the month is 12:00, click next month, the year plus 1, the month becomes 01


if($month == 0)
{
    $year--;
    $month = 12;
}
if($month == 13)
{
    $yearPP;
    $month = 1;
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3897d-2c121.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3897d-2c121.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?