Hello, I need to add a button to my table that will switch between content for the table only. I don't want to have to create a new ASP page in order to display the Forward or Backward data. I thought it was easy but I'm having a hard time getting it to work. Below is my code for my existing page. The next/previous button is the button that I want to use to display other data from my database. I store comments for each month in the database and want to be able to go back and forth between the monthly comments. The name of this ASP page is USERID(FromDB)_comments.asp. Thank you in advance.
Code:
<!-- #includes file="includes/dbconn.inc" -->
<title>Comments for - Mr. Smith</title>
<%
dim strmonthly
dim stryearly
dim strday
strmonthly=datepart("m",date)
stryearly=datepart("yyyy",date)
strday=datepart("d",date)
If strmonthly="1" then
strmonthly="January"
elseif strmonthly="2" then
strmonthly="February"
elseif strmonthly="3" then
strmonthly="March"
elseif strmonthly="4" then
strmonthly="April"
elseif strmonthly="5" then
strmonthly="May"
elseif strmonthly="6" then
strmonthly="June"
elseif strmonthly="7" then
strmonthly="July"
elseif strmonthly="8" then
strmonthly="August"
elseif strmonthly="9" then
strmonthly="September"
elseif strmonthly="10" then
strmonthly="October"
elseif strmonthly="11" then
strmonthly="November"
elseif strmonthly="12" then
strmonthly="December"
else
end if
If Request.QueryString("s") = "" Or Request.QueryString("s") = "sn" Then
sortBy = "member"
Elseif Request.QueryString("s") = "tp" Then
sortBy = "tpoints"
Elseif Request.QueryString("s") = "mm" Then
sortBy = "memo"
End If
strSQL = "Select * FROM Home ORDER BY "& sortBy
Set rsStatus = Server.CreateObject("ADODB.Recordset")
rsStatus.open strSQL, db
%>
<h1>CSSO-PT Team "Dare to Soar" Comments:</h1>
<hr>
<center>
[b]'WHAT DO I DO HERE FOR MY PREVIOUS BUTTON TO PULL MY OTHER DATA FROM THE DATABASE??
<FORM>
<INPUT TYPE="BUTTON" VALUE="Previous Month" ONCLICK="window.location.href='../cssopt/"& rsHome("ID") &"_comments.asp'"><INPUT TYPE="BUTTON" VALUE="Home" ONCLICK="window.location.href='../cssopt/Home.asp'">
<INPUT TYPE="BUTTON" VALUE="Next Month" ONCLICK="window.location.href='../cssopt/"& rsHome("ID") &"_comments.asp'">
</FORM>
[/b]
</center>
<form name="frmMain" action=rsHome("ID") &"_comments.asp?s=<%=Request.QueryString("s")%>" method="get">
<table class="table1">
<tr>
<td class="td1"><center><a class="style1">Team Member - Mr. Smith - <%= strmonthly %> Comments</a></center></td>
</tr>
<%
str2SQL = "Select * FROM Home"
Set rsStatus = Server.CreateObject("ADODB.Recordset")
rsStatus.open str2SQL, db
While Not rsStatus.eof
If rsStatus("ID")="1" then
Response.Write "<tr><td class=td1 align=center><textarea class=style2 ROWS=25 COLS=125 Wrap=Physical name=txtMemo"& rsStatus("ID") &">"& rsStatus("ttmemo") & chr(13) & rsStatus("tt2memo") & chr(13) & rsStatus("tt3memo") & chr(13) & rsStatus("tt4memo") & chr(13) & rsStatus("tt5memo") & chr(13) & rsStatus("tt6memo") & chr(13) & rsStatus("tt7memo") & chr(13) & rsStatus("tt8memo") & chr(13) & rsStatus("tt9memo") & chr(13) & rsStatus("tt10memo") &"</textarea></td></tr>"
End If
rsStatus.movenext
Wend
%>
</table>
<hr>
</form>
</body>