473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

php calendar to generate checkboxes next to each date

does anyone know of a script that would produce a calendar starting
from todays date with checkboxes next to every day of the month so that
the user is able to check it in case of an event for that day...
without specifying what the event is... just a simple checkbox..

Apr 19 '06 #1
6 4248
NC
Kentor wrote:

does anyone know of a script that would produce a calendar starting
from todays date with checkboxes next to every day of the month so that
the user is able to check it in case of an event for that day...
without specifying what the event is... just a simple checkbox..


Something like this should do the trick:

$timestamp = time();
$month = date('m', $timestamp);
while ($month == date('m', $timestamp)) {
$dateMDY = date('F j, Y', $timestamp);
$dateYMD = date('Y-m-d', $timestamp);
echo "<input type='checkbox' name='dates[]' ",
"value='$dateYMD'>$dateMDY<br>\r\n";
$timestamp = $timestamp + 24*60*60;
}

This will give you a checkbox for every day from today until the end of
the current month... The list (or, rather, array) of checked dates
will be available to the receiving script as $_POST['dates'] or
$_GET['dates'], depending on what method the form uses.

Cheers,
NC

Apr 19 '06 #2
On 18 Apr 2006 17:18:33 -0700, "Kentor" <ke****@gmail.com> wrote:
does anyone know of a script that would produce a calendar starting
from todays date with checkboxes next to every day of the month so that
the user is able to check it in case of an event for that day...
without specifying what the event is... just a simple checkbox..


Modify something like this:
<http://www.micronetwork.de/activecalendar/>

--
Locate your Mobile phone: <http://www.bizorg.co.uk/news.html>
Great gifts: <http://www.ThisBritain.com/ASOS_popup.html>
Apr 19 '06 #3
perfect this little php script would do :) and i suppose
http://www.micronetwork.de/activecalendar/ would also work.. i just
need to play with it a bit.
NC: how would i display this for 12 months ahead, starting from the
current date? and have it all sorted by months only showing the date
number and the month as a header for each month, and then a big year
header for the 2 years that would appear?

Apr 19 '06 #4
and also how would go about storing the checked boxes in the database
for faster usage and retrieving those dates that have been checked so i
could display a calendar with different colors for checked/non checked
dates? :)

Apr 19 '06 #5
NC
Kentor wrote:

NC: how would i display this for 12 months ahead, starting from the
current date? and have it all sorted by months only showing the date
number and the month as a header for each month, and then a big
year header for the 2 years that would appear?


$timestamp = time();
$cutoff = strtotime(date('Y-m-d 23:59:59', $timestamp) . ' + 1 year');
// you could use $cutoff = $timestamp + 365*24*60*60,
// but it ignores leap year...
$year = date('Y', $timestamp);
$month = date('m', $timestamp);
$month_text = date('F', $timestamp);
echo "<h1>$year</h1>\r\n";
echo "<h2>$month_text</h2>\r\n<p>";
while ($timestamp <= $cutoff) {
if ($year <> date('Y', $timestamp)) {
$year = date('Y', $timestamp);
echo "<h1>$year</h1>\r\n";
}
if ($month <> date('m', $timestamp)) {
$month = date('m', $timestamp);
$month_text = date('F', $timestamp);
echo "<h2>$month_text</h2><p>\r\n";
}
$day = date('j', $timestamp);
$dateYMD = date('Y-m-d', $timestamp);
echo "<input type='checkbox' name='dates[]' ",
"value='$dateYMD'>$day \r\n";
$timestamp = $timestamp + 24*60*60;
}

Cheers,
NC

Apr 19 '06 #6
awsome, i just need to make this look nice now :)

Apr 19 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mal | last post by:
Hello. I have a database that tracks reservations at a campground. I want to be able to make a calendar type report that shows how many people are here in given period. Stored for each...
1
by: EV | last post by:
We have put a calendar control on a form. The form is for employee time off. The user chooses the employee and the type of time off (sick, comp, vacation, etc)...then clicks on the calendar to...
1
by: bill yeager | last post by:
I would like to place the currently selected date (retrieved from the database) on a calendar control which is embedded inside a datagrid. However, I can't find the ID of the control to do so....
9
by: Greg | last post by:
Hi, I have a table with "dates", i'd like to display those dates on a calendar. I've put a calendar in a form, linked to my "date" field, and it works, but only showing one "date" per calendar....
0
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
1
by: abhishekbrave | last post by:
The code below is opening a calendar on mouse over in the same window. I need the calendar to be opened in new window. Have to fulfill this requirement urgentely so posting the whole code here. I...
0
by: creejohn | last post by:
Hi all-- I'm really stumped here. I have a (c# 2.0) calendar control that loads a menu for each day inside the cell corresponding to that day in the dayrender event. That is all working great. I...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
1
by: swethak | last post by:
hi, i have a code to disply the calendar and add events to that. It works fine.But my requirement is to i have to disply a weekly and daily calendar.Any body plz suggest that what modifications i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.