Link to home
Start Free TrialLog in
Avatar of sormafre
sormafre

asked on

Populate drop-down box

I am using MS FrontPage and I would like to populate a drop-down box with the dates of 30 days starting toworrow.

Example:
(today is 3/2/2003)

the drop-down box should contain:
4/2/2003
5/2/2003
6/2/2003
7/2/2003
...and so on for 30 days.

Could anyone help me in this matter please?
Avatar of stefri
stefri
Flag of France image

If ASP page, you will create on the fly the dropdown incrementing today's date by one day using dattadd function:
Get current day
Loop to 30, adding days to current day usind dateadd

today = date()
response.write "<select size='1' name='theDate'>"

for i = 1 TO 30
   response.write "<option>" & dateadd("d",i,today)& "</option>"
next
response.write "</select>"
Avatar of hhammash
hhammash

Hi,

You can use this code: (it is 100% working)

 <select size="1" name="MyDate">
  <%
  Dim idate
  idate=date()
  for i=1 to 30
  tmrDate=idate+i
  %>
  <option value="<%=tmrDate%>"><%=tmrDate%></option>
  <%
  Next
  %>
  </select></p>

Regards
hhammash
Avatar of sormafre

ASKER

hi,
thx for ur replies, but I am very useless :-(
I copied the code into frontpage, but it doesnt seem to work...
Hi,

Copy the code first to NotePad,  then from NotePad copy it to Frontpage ans save your page as .asp.

It will work
hhammash
Hey,
wow...that was a quick reply. I have tried that. but all I get is an empty drop-down box.
Hi,

Can you please post your code?

hhammash
Here u go:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="tlb, default">
</head>

<body>
<select size="1" name="MyDate">
<%
Dim idate
idate=date()
for i=1 to 30
tmrDate=idate+i
%>
<option value="<%=tmrDate%>"><%=tmrDate%></option>
<%
Next
%>
</select></p>

</body>

</html>
ASKER CERTIFIED SOLUTION
Avatar of hhammash
hhammash

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here u go:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Theme" content="none, default">
<meta name="Microsoft Border" content="tlb, default">
</head>

<body>
<select size="1" name="MyDate">
<%
Dim idate
idate=date()
for i=1 to 30
tmrDate=idate+i
%>
<option value="<%=tmrDate%>"><%=tmrDate%></option>
<%
Next
%>
</select></p>

</body>

</html>
Thx,
perfect...I had an .htm and an .asp version, and I used the wrong one. very happy now :-)

laters,
SorMaFre
Hi,

Glad it worked

hhammash
i dont know how u handle that points system here. Did u get them point?
Hi,

Next to my answer with the code you will see a "Accept this answer" then you will get a field with the points you designated.  After that select the level A to C A is the highest.  A or B or C each has different value.

You will still give away the same points,  but your selection of A or B or C will decide what should I receive.

Thanks a lot
hhammash