Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default date in select options

Status
Not open for further replies.

dom24

Programmer
Aug 5, 2004
218
0
0
GB
Hi,

I'm creating a room booking system and so far I have 3 drop down menus at the top of the screen where the user can select the day, month and year.
I have hard coded the dates so that they can be written to the database when required, rather than add every date to the database and pull them back.

I want the date to dispaly the current date when the user opens the page. Does anyone know how I can set the Selected Values of the Option so that is will use today's day, month and year?

Thanks.
 
For today...

<%=Year(Now())%> returns 2005
<%=Month(Now())%> returns 1
<%=Day(Now())%> returns 21
<%=MonthName(Month(Now())%> returns January
<%= WeekDayName(WeekDay(Now())) %> returns Friday

use these for option values in your drop down list...

-L
 
The only thing wit that is that rather than it add the day, month or year to the drop down list, I want it to select the value automatically from the options.
Is this possible?

Currently I have:

<SELECT NAME="day">
<OPTION SELECTED Value=<%=day(Now())%>><%=day(Now())%>
<OPTION>1
etc............

and the list shows

21
1
2
3
4
5
etc.....

I want it to just select "21" from the list.
 
Check your other (identical) thread, I think I covered it in there: thread333-989434

barcode_1.gif
 
Great thanks i'll try it and let you know.
Sorry about posting 2 by the way, didn't mean to!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top