Assuming the user gives you the year and the month, you can also get the number of days like this:
<?php
//Number of days for the given month and year
$month = "2";
$year = "2008";
$days = date("t", mktime(0, 0, 0, $month, 1, $year));
// Prints: The year/month 2008/2 has 29 days!
echo...