0

Ok here is what I want to do:

I am going to have a "6 upcoming events" (baseball games) section on my website but I want to be able to enter all of the games on one day and have it show the 6 upcoming games on the website. The thing Is I want to able to enter them all and ignore the ones that have already happened (a date will be one field I am entering). Has anyone seen a script that could help me with this?

2
Contributors
1
Reply
2
Views
12 Years
Discussion Span
Last Post by Troy
0

The first thing that came to my mind was a javascript solution, but here is a php solution:

<?php

if (date('Y-m-d',strtotime('6/1/2005')) >= date('Y-m-d',time())) {
  echo "<br />June 1:  Game 1, blah, blah, blah";
}

if (date('Y-m-d',strtotime('6/15/2005')) >= date('Y-m-d',time())) {
  echo "<br />June 15:  Game 2, blah, blah, blah";
}

if (date('Y-m-d',strtotime('7/03/2005')) >= date('Y-m-d',time())) {
  echo "<br />July 3:  Game 3: blah, blah, blah";
}

?>

You could also do a DHTML solution where you place each game within a DIV or SPAN. Give each DIV or SPAN an id equal to the game date. Then have a javascript fire onload that looks at all the DIVs or SPANs and if date is less than today, set (element).style.display="none";

PHP solution means you don't have to worry about any browser compatibility issues.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.