Jump to content

PHP calendar help


AJLX

Recommended Posts

Hello Guys,

My goal is to make a Php and SQL calendar. I started learning php and sql a while ago, and basically got distracted. I'm now back, with a new project in the unhelpful position of having forgotten most of what I had learnt!

 

I am making a project where I want to make a booking system. I have 3 rooms that are available to be booked Room 1, Room 2 and Room 3. I want to make a table that displays the current year in the top row, with the option to be able to click on a '<' or a '>' to change years. I want the same option for months and weeks. I think I am happy with how I would do this. The next bit is more tricky. I want a column for each of the days of the week. directly under this I want to display the correct date, under the correct day, starting with the current week we are on. for example it might look like this:

 

              -------------------------------------------

              |            <    2012      >                    |

              -------------------------------------------

              |            <      March    >                  |

              -------------------------------------------

              |            <      2    >                          |

              -------------------------------------------

              |mon | tues | wed| thur | fri  | sat | sun |

              | 5th  |  6th |  7th|  8th |9th |10th| 11th |

              ---------------------------------------------

Room 1  | yes    |        |      |      |      |    |        |

              ----------------------------------------------

Room 2  |        |        | yes  |      |      |    |        |

              ----------------------------------------------

Room 3  |        |        |      |      |yes  |    |        |

              ----------------------------------------------

 

Although at the moment I'm struggling with the whole flippin' thing, the main issue is getting the correct dates to line up under the correct days of the week. I'm not asking for you to do this for me- but a bit of gentle help in this, and maybe some general advice in what I'm trying to achieve would be really useful!

 

Regards,

 

AJLX

Link to comment
Share on other sites

Hi guys,

Sorry I can't seem to find an edit button? I have made a start on building a table to do what I want: www.swerv.ajlx.co.uk

My current issue is trying to make the previous and next buttons work for the year, month, and week.

I am using this as the code for the '>' year button.

 

echo "<a href='{$_SERVER['PHP_SELF']}?nextyear=nextyear'> > </a>";

 

I am then checking the url, and then trying to implement this code:

                if($_GET['nextyear']=="nextyear")
	$year = strtotime(date("Y", strtotime($date)) . " +1 year");
	else($year = date('Y'));

 

Can any one see what is obviously wrong with the above code? presumably once this bit is done it will be easy to copy it for months, and then, with a bit of tweeking the weeks.

 

Regards

 

Andy Jones

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.