954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Please Help Me Out !!!

I am about to start my final year project, my project is about "Online Appointment Booking System".
I started by displaying calendar, but i have a problem displaying the calendar "WEEKLY".
i want to calendar to show current week, if possible a button that allow user to view next week and previews week. i will really appreciate any help.

yusufmiko
Newbie Poster
5 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

you can simply access the current day with the date-function. I think it's date("D") for the name of the day. As today is sunday you now that the 20th was monday, 27th is the next monday and so on.

sDJh
Posting Whiz in Training
259 posts since Aug 2005
Reputation Points: 56
Solved Threads: 29
 

thanks sdjh, the current code i have is

[COLOR="Red"]

<?php
function showCalendar(){
// Get key day informations.
// We need the first and last day of the month and the actual day
$today = getdate();
$firstDay = getdate(mktime(0,0,0,$today['mon'],1,$today['year']));
$lastDay = getdate(mktime(0,0,0,$today['mon']+1,0,$today['year']));


// Create a table with the necessary header informations
echo '';
echo ' '.$today['month']." - ".$today['year']."";
echo '';
echo ' MoTuWeTh';
echo ' FrSaSu';


// Display the first calendar row with correct positioning
echo '';
for($i=1;$i<$firstDay['wday'];$i++){
echo ' ';
}
$actday = 0;
for($i=$firstDay['wday'];$i<=7;$i++){
$actday++;
if ($actday == $today['mday']) {
$class = ' class="actday"';
} else {
$class = '';
}
echo "$actday";
}
echo '';

//Get how many complete weeks are in the actual month
$fullWeeks = floor(($lastDay['mday']-$actday)/7);

for ($i=0;$i<$fullWeeks;$i++){
echo '';
for ($j=0;$j<7;$j++){
$actday++;
if ($actday == $today['mday']) {
$class = ' class="actday"';
} else {
$class = '';
}
echo "$actday";
}
echo '';
}

//Now display the rest of the month
if ($actday <$lastDay['mday']){
echo '';

for ($i=0; $i<7;$i++){
$actday++;
if ($actday == $today['mday']) {
$class = ' class="actday"';
} else {
$class = '';
}

if ($actday <= $lastDay['mday']){
echo "$actday";
}
else {
echo ' ';
}
}


echo '';


}

echo '';
}

showCalendar();


The above code display the whole calendar, i need it to display one week (current week) i.e the first row, then they should be be two buttons that allow you to choose next and preview weeks respectively.

Help me out please, anyone

yusufmiko
Newbie Poster
5 posts since Oct 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You