I'm sure there's a more eloquent way of doing this, but one idea pops to mind immediately. Using mktime will automatically correct
$month = $_GET['month'];
$day = $_GET['day'];
$year = $_GET['year'];
$picdate = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year));
$newdate = explode(date("Y-m-d", mktime(0, 0, 0, $month, $day+1, $year)), "-");
$olddate = explode(date("Y-m-d", mktime(0, 0, 0, $month, $day-1, $year)), "-");
Then, run your code on the $picdate variable, which will now be valid. Then, for the previous and next buttons, simply
echo "<a href=\"./index.php?month=$olddate[1]&day=$olddate[2]&year=$olddate[0]\">Previous</a>
<a href=\"./index.php?month=$newdate[1]&day=$newdate[2]&year=$newdate[0]\">Next</a>";
By the by, thank you for putting some thought into your first post. I always like helping people who actually use capitalization and punctuation.