Calendar help!

Hey guys

I’m working on a booking system for a friend. Here is the project so far:
www.swerv.ajlx.co.uk

I’m currently having issues with the diary bit. I’m struggling to get the year’s and months to cycle through when the ‘<’ and ‘>’ buttons are used. The main issue is getting the week buttons to cycle the dates along on the sat sun mon… headings.

My first idea was to try something like this:
[php]echo "<a href=’{$_SERVER[‘PHP_SELF’]}?nextyear=nextyear’> > ";[/php]

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

[php] if($_GET[‘nextyear’]==“nextyear”)
$year = strtotime(date(“Y”, strtotime($date)) . " +1 year");
else($year = date(‘Y’));[/php]

Can any one see what is obviously wrong with the above code? Can you also suggest how I might do the weeks section?

Regards

Andy Jones

Well, if you have a PHP page that pulls data and displays it in a table, you are already have a way of pulling the data. When you do the query to pull the info, what are you using for the SQL query? Just, pass that back to the page.

Many ways to do that. Either pass it back with an argument. ( ? ) Or, I use SESSION variables so the user does not see the variable being passed. Basically, I use something like current week or whatever the left/right buttons are set for. Use $_SESSION[‘currentweek’]=something; This would be changed in the PHP code when the left/right buttons were changed and the display code in the calendar display would use the session variable’s value to display the current calendar… Hope that makes sense…

Sponsor our Newsletter | Privacy Policy | Terms of Service