Here is my code. As always I don't understand what beginning asp 3.0 . The book says to do this code, but doesn't explain what vartodaymonth means or varTodayDate = day(now()) means. I am suppose to make two files one html file and in it have the months of the year and only one month should be passed on to the asp page. Not sure how to do that? In that page all of the days of the month I choose should be displayed Like this
The days of ____ are 1
The days of ____ are 2 etc.
In that blank should be the month I chose to use.
Here is all I can come up with using the book beginning active server pages 3.0 p 195 if you know this book.
<html>
<head>
<title>Example Do While</title>
</head>
<body>
<H1>This is the days of January</H1>
<%
varRowCount = 1
varTodayDate = day(now())
varTodayMonth = MonthName(month(date())
Response.Write "<h2>Report for " & varTodayMonth & "</h2>"
Do While varMonthCount <32 or <= 31
Response.Write "The days of " & varTodayMonth & " " & varRowCount
Response.Write ": are varTodayDate<br>"
varRowCount = varRowCount + 1
Loop
%>

</body>
</html>

The book says this will display if requested on the ninth of september.
How do I get it to display the month of January and say
The days of January are 1
The days of Januray are 2
and so on
If anyone knows of another book that explains asp code to a beginner with examples please let me know

The problem is here:

You have:

<%
varRowCount = 1
varTodayDate = day(now())
varTodayMonth = MonthName(month(date())
Response.Write "<h2>Report for " & varTodayMonth & "</h2>"
Do While varMonthCount <32 or <= 31
Response.Write "The days of " & varTodayMonth & " " & varRowCount
Response.Write ": are varTodayDate<br>"
varRowCount = varRowCount + 1
Loop
%>

It should be:

<%
varRowCount = 1
varTodayDate = day(now())
varTodayMonth = MonthName(month(date())
Response.Write "<h2>Report for " & varTodayMonth & "</h2>"
Do While varMonthCount <32 or varMonthCount  <= 31
Response.Write "The days of " & varTodayMonth & " " & varRowCount
Response.Write ": are varTodayDate<br>"
varRowCount = varRowCount + 1
Loop
%>

Or you can make it a bit more dynamic by allowing the user to select the month and then display the days in that month, as below:

<form>
<select size="1" name="Month">
<option value="January">Jan</option>
<option value="February">Feb</option>
<option value="March">Mar</option>
<option value="April">Apr</option>
<option value="May">May</option>
<option value="June">Jun</option>
</select>
<input type="submit" value="Choose Month">
</form>
<%
dim intDay  '// incremental number used in the loop
dim daysInMonth '// the number of days in each month
dim strMonth '// the selected month

intDay = 1 '// set the value to 1 to start
strMonth = request("month") '// set the month to the one selected in the form

If strMonth <> "" Then '// If a month has been selected display the results

 '// assign the number of days to each month
Select Case strMonth
Case "January", "March", "May", "July", "August", "October", "December"
 daysInMonth = 31
Case "February"
 daysInMonth = 28
Case Else
 daysInMonth = 30
End Select

'// Display the total number of days in the selected month
Response.Write "The days of " & strMonth & " are "
'// Then loop through the days in the month, starting at 1
Do While intDay <= daysInMonth
 Response.Write intDay & ", "
 intDay = intDay + 1
Loop 

Else '// there has been no month selected so....
' do nothing
End If 
%>

Or you can make it a bit more dynamic by allowing the user to select the month and then display the days in that month, as below:

Thanks so much you have been so much help to me. YOUR GREAT!

This article has been dead for over six months. Start a new discussion instead.