PHP日历 - 隐藏今天之前的日子

I have a calendar on my website using PHP/HTML and it works fine except that for some reason it is displaying the last 5 days previous to today's date when ideally I want them to be hidden. Here is my PHP & CSS code:

.calendarHeader{
    text-align: center;
    text-decoration: underline;
    color: #303030;
}
.calendarDates{
    margin: 30px auto auto auto;
    width: 280px;
}
.calendar{
    margin: 10px auto auto auto;
    width: 280px;
}
.calendarCell{
    float: left;
    width: 40px;
    color: #707070;
    text-align: center;
    padding: 5px 0px 5px 0px;
}
.calendarCell:hover{
    color: #000000;
}
.calendarBlank{
    color: #E9EAEB;
    cursor: default;
}
.calendarBlank:hover{
    color: #FFFFFF;
}
.calendarToday{
    color: #BC3415;
    font-weight: bold;
}

<?php
$today = date("d"); // Current day
$month = date("m"); // Current month
$displaymonth = date("F");
$year = date("Y"); // Current year
$days = cal_days_in_month(CAL_GREGORIAN,$month,$year); // Days in current month

$lastmonth = date("t", mktime(0,0,0,$month-1,1,$year)); // Days in previous month

$start = date("N", mktime(0,0,0,$month,1,$year)); // Starting day of current month
$finish = date("N", mktime(0,0,0,$month,$days,$year)); // Finishing day of  current month
$laststart = $start - 1; // Days of previous month in calander

$counter = 1;
$nextMonthCounter = 1;

echo '

    <div class="calendarHeader"><strong>'.$displaymonth.' '.$year.'</strong></div>
    <div class="calendarDates">
        <div class="calendarCell"><b>M</b></div>
        <div class="calendarCell"><b>T</b></div>
        <div class="calendarCell"><b>W</b></div>
        <div class="calendarCell"><b>T</b></div>
        <div class="calendarCell"><b>F</b></div>
        <div class="calendarCell"><b>S</b></div>
        <div class="calendarCell"><b>S</b></div>

        <div class="clearLeft"></div>
    </div>
    <div class="calendar">
    ';

    if($start > 5){ $rows = 6; }else {$rows = 5; }

    for($i = 1; $i <= $rows; $i++){
        for($x = 1; $x <= 7; $x++){             

            if(($counter - $start) < 0){
                $date = (($lastmonth - $laststart) + $counter);
                $class = 'calendarBlank';
            }else if(($counter - $start) >= $days){
                $date = ($nextMonthCounter);
                $nextMonthCounter++;

                $class = 'calendarBlank';

            }else if($counter <= $today){
                $date = ($counter - $start + 1);
                $class = 'calendarBlank';
            }else {
                $date = ($counter - $start + 1);
                if($today == $counter - $start + 1){
                    $class = 'calendarToday';
                }
            }                                       

            echo '<a href="events.php" target="_parent"><div class="calendarCell '.$class.'">'.$date.'</div></a>';

            $counter++;
            $class = '';
        }
    }

    echo '
    <div class="clearLeft"></div>
    </div>
    <div class="calendarNavigation">
        <div class="floatLeft">&laquo; <a href="calendar.php?month=-1">Previous Month</a></div>
        <div class="floatRight"><a href="calendar.php?month=+1">Next Month</a> &raquo;</div>
        <div class="clearBoth"></div>
    </div>
';
?>

Can anyone tell me how to block out everything previous to today's date?

Also, as you can see, I'd like to have a next & previous months navigation but I don't know how to get the navigation to refresh the php script with the relevant month information. Any help on this would be hugely appreciated too

Why dun you simply do this?

$currDay = date("j"); //at top of your code

and then in loop.

if((int)$currDay > (int)$date) {
   $class  ='calendarBlank';
}

This will do.

PS. Lemme know if you need complete code.