Anspaujd
-
Posts
2 -
Joined
-
Last visited
Posts posted by Anspaujd
-
-
I am working on a form with php generated values. What I have right now is as follows:
<tr> <td><p>ENTRY TERM: <select name="entry_term" > <option value="">Choose One:</option> <?php $year=date("Y"); for ($y=0;$y<5;$y++) { echo '<option value="Fall '.($year+$y).'">Fall '.($year+$y).'</option>'; echo '<option value="Spring '.($year+$y+1).'">Spring '.($year+$y+1).'</option>'; } ?> </select> </p></td>
This currently generates a list of :
Fall 2014
Spring 2015
Fall 2015
Spring 2016
Fall 2016
...etc for next 5 years
What I need to do is have this time sensitive to exclude once a specific month has passed. For example once August 2014 has started "Fall 2014" should be excluded... or when Jan 2015 has started "Spring 2015" should be excluded.
Can someone help me solve this as I am unsure of how to move forward with this.
Thanks,
Date exclusion on form population
in PHP Coding Help
Posted
Yes I understand that the code as is will cut based on July which is why I am seeking guidance on expanding it to cut the current Fall if August is passed or cut the current Spring if January is passed.
I have tried IF / ELSE but I can only make this work for the current month rather than excluding based on a specific month.
Ultimately, I need this to read as follows:
Fall 2014
Spring 2015
Fall 2015
... etc
if the month is before August
After August it should read:
Spring 2015
Fall 2015
Spring 2016
... etc
AT THE SAME TIME THE FORM NEEDS TO ALSO READ FOR JANUARY... meaning if January is passed it should read as:
Fall 2015
Spring 2016
Fall 2016
... etc
Does this make sense?
I was able to make it work to cut the Fall based on July as the month (or any month) but I need it to also dictate excluding Spring if the month is January.