Hi I am doubtful even your code run without error...
$num = cal_days_in_month(CAL_GREGORIAN, $Month, $cYear); It is following a html. So not php. You need to have a php opening like
<?php $num = cal_days_in_month(CAL_GREGORIAN, $Month, $cYear);</pre?>