Forum Moderators: open
Also, I want to populate the month box depending on what year is selected in the year box...
say for e.g., if user selects 2008 from year drop down, the month drop down should just have months jan and feb...
if user selects 2007 in the year drop down,thn month drop down will be jan to dec....
How to do this?
Looking forward to ur reply!
While this solution is from data populated from a database, the method still applies here.
<FORM action="<? echo $_SERVER['PHP_SELF']; ?>" method="GET">
<SELECT NAME="year">
<Option value="2007">2007</option>
<Option value="2008">2008</option>
</SELECT>
<input type="submit" name="Go" value="Go">
</FORM>
I also have $_SESSION['year'] and $_GET['year']...
The first time user goes to this page, the year is taken from the SESSION variable, after tht it is taken from GET...
How do i implement it in here?
i was looking for this:
<SELECT NAME="year">
<Option value="2007" <? if((isset($_GET['year'])?$_GET['year']:$_SESSION['year'])==2007) echo "selected" ?>>2007</option>
<Option value="2008" <? if((isset($_GET['year'])?$_GET['year']:$_SESSION['year'])==2008) echo "selected" ?>>2008</option>
</SELECT>
If you are going to be needing these values over and over again you might just want to consider using cookies and storing them that way. Then you know where to get them when you need that data and if you need to make an update, you just update the cookie directly. Not to mention cookies and accessible through php and javascript, so it should work out well if you decide to take that implementation.