|Get best price on Unlocked Galaxy S10 Lite
PHP: Web Calendar With Events
This coding example builds a calendar for the current month. It provides navigation to go backward or forward, month-by-month. Click a date to fill in a form to add an event.
Use the calendar with or without the "add event" feature. Building a calendar on-the-fly without other bells and whistles has its practical uses.
Take a look at the demo of the calendar before we discuss how it works.
Building the Calendar for the Current Month
Next, figure out the last day of the month. I loop through the days 28th - 32nd and create a new date out of it. Compare the current month to this new date's month. If it changed, the previous day was the last day of the month.
You then start on the first day, postitioning yourself over however many weekdays the first is in. Next, loop through all the days until the day reaches the end of the month. Keep track of the weekdays using modulus 7 to find the end of each week.
More Info About Calendars
I wrote a similar calendar in ASP. You can download the JScript ASP source code for that calendar below. Note it is different than the PHP version shown here.
Download PHP Source Here (datemenu_php.phps)
Download ASP Source Here (datemenu_asp.txt)
Test Google Ads Ver. 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)
Least Popular Pages
iNews Applet (Java)
Site Monitor (Perl)