Using HTML to create a Web form to allow user to submit a particular date (i.e. Jan-2008). Upon submitting the date, the specific month of the year will be plotted and displayed to the user. This is my sample screen : (Web Form) Please Enter Date (mon-yyyy) : (Jan-2008) (Plot) (Submit) (Calendar) Monday Tuesday Wednesday Thursday Friday Saturday Sunday 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 (Highlight the Sunday column with red color) Anyone who possessed this answers or this php & html coding please do tell me, i had some code but i failed, Thanks guys, please help this kind soul! Below is my retarded coding, think it was wrong tho <table style="margin: auto"> <tr> <?php for($month=1; $month<=12; $month++){ ?> <td style="vertical-align: top"> <?php $weblog->printCalendar($year, $month); ?> </td> <?php if($month%3 == 0 and $month<12){ ?> </tr><tr> <?php } ?> <?php } ?> </tr> </table>
It looks like you are using Keith Devens' PHP Calendar there (http://keithdevens.com/software/php_calendar), so assuming that is the case... Make sure you have saved the source code (available at http://keithdevens.com/software/php_calendar/source) as, for example, calendar.php. The following code will display a calendar for a user specified month and year. If none are supplied it will display the current month and year. <?php include("calendar.php"); $year = $_GET['year']; $month = $_GET['month']; if ($year && $month) { echo generate_calendar($year, $month); } else { $time = time(); echo generate_calendar(date('Y', $time), date('n', $time)); } ?> PHP: Put that code in a file in the same directory as the calendar.php file and add for example ?year=2010&month=8 after the file name when accessing it to set the date. You could of course also write an HTML form for the user to input the date.