Jump to content

Passing text page to page


twindude

Recommended Posts

First i have 3 pages........ One DatabaseI have a query that works and gets the database info and displays it!Problem:first page pulls a list from DB and displays it, repeat region show all recordssecond page (view record) should view the record choosen with more detailed info of that record (wrong info displayed, ONLY first record in DB, no matter which record i choose from page one)third page allows for change/update of the database info in text boxes with form (wrong info displayed ONLY first record in DB, no matter which record i choose from page one)I have the correct row variable working (see it in the address bar).........but the text is wrong and only show the first record in the databaseseem like its not passing the text info from page to page? not sure?Can anyone help, I can also send the code if requested....email or post reply.... luv_lafs.yahoo.com

Link to comment
Share on other sites

You'll have ot post your code if you want us to help you. We can't guess as to where you made mistakes in your code if we cannot see it :)

HERE IS THE CODE.....<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!--#include file="Connections/SvrList.asp" --><%Dim Recordset1Dim Recordset1_numRowsSet Recordset1 = Server.CreateObject("ADODB.Recordset")Recordset1.ActiveConnection = MM_SvrList_STRINGRecordset1.Source = "SELECT * FROM SvrList ORDER BY ID ASC"Recordset1.CursorType = 0Recordset1.CursorLocation = 2Recordset1.LockType = 1Recordset1.Open()Recordset1_numRows = 0%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>View Record</title><style type="text/css"><!--.style1 {color: #FFFFFF}--></style></head><body><table width="100%" border="0" align="center" bordercolor="#D4D0C8" bgcolor="#990000"> <tr> <td bgcolor="#990000"><h1 align="center" class="style1 style1">Server Record</h1></td> </tr></table><table width="100%" height="30" border="0" bordercolor="#CCCCCC" bgcolor="#CCCCCC"> <tr> <td><table width="510" border="0" align="center"> <tr> <td width="44%"> </form> </td> <td width="56%"> <form name="form2" method="post" enctype="application/x-www-form-urlencoded" action="/serverlist/serverinfo.asp" target="_self"> <input name="Submit" type="submit" value="Home"> </form> </td> </tr></table> </td> </tr></table><table width="100%" border="0" bordercolor="#0033FF" bgcolor="#0033FF"> <tr> <td><div align="center"><span class="style1"><strong><%=(Recordset1.Fields.Item("ServerName").Value)%></strong></span></div></td> </tr></table><table width="100%" border="1" align="center" bgcolor="#990000"> <tr> <td width="50%"><table width="100%" border="0"> <tr bgcolor="#CCCCCC"> <td width="28%"><strong>Server Name:</strong></td> <td width="72%"><input type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("ServerName").Value)%>"></td> </tr> </table></td> <td width="50%"><table width="100%" border="0"> <tr bgcolor="#CCCCCC"> <td width="20%"><strong>IP Address: </strong></td> <td width="60%"><input name="text2" type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("IP").Value)%>"></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0"> <tr bgcolor="#999999"> <td width="28%" bgcolor="#999999"><strong>Domain :</strong></td> <td width="72%"><input type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("Domain").Value)%>"></td> </tr> </table></td> <td><table width="100%" border="0"> <tr bgcolor="#999999"> <td width="20%"><strong>Subnet:</strong></td> <td width="60%"><input type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("SubnetMask").Value)%>"></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0"> <tr bgcolor="#CCCCCC"> <td width="28%"><strong>Network:</strong></td> <td width="72%"><input type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("Network").Value)%>"></td> </tr> </table></td> <td><table width="100%" border="0"> <tr bgcolor="#CCCCCC"> <td width="20%"><strong>Model: </strong></td> <td width="60%"><input name="textarea42" type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("Model").Value)%>"></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0"> <tr bgcolor="#999999"> <td width="28%" bgcolor="#999999"><strong>iLO IP :</strong></td> <td width="72%"><input name="textarea" type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("iLoIP").Value)%>"></td> </tr> </table></td> <td><table width="100%" border="0"> <tr bgcolor="#999999"> <td width="20%" bgcolor="#999999"><strong>Serial:</strong></td> <td width="60%"><input name="textarea3" type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("Serial").Value)%>"></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0"> <tr bgcolor="#CCCCCC"> <td width="28%"><strong>iLO Pswd:</strong></td> <td width="72%"><input name="textarea5" type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("iLoPswd").Value)%>"></td> </tr> </table></td> <td><table width="100%" border="0"> <tr bgcolor="#CCCCCC"> <td width="20%"><strong>iLoKey: </strong></td> <td width="60%"><input name="text" type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("iLoKEY").Value)%>"></td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0"> <tr bgcolor="#999999"></tr> </table> <table width="100%" border="0"> <tr bgcolor="#CCCCCC"> <td width="28%"><strong>OS:</strong></td> <td width="72%"><input name="textarea7" type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("OS").Value)%>"></td> </tr> </table></td> <td><table width="100%" border="0"> <tr bgcolor="#CCCCCC"> <td width="20%"><strong>Comments:</strong></td> <td width="60%"><Textarea name="textarea2" rows="1" WRAP="virtual" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px"><%=(Recordset1.Fields.Item("Comments").Value)%></textarea></td> </tr> </table></td> </tr></table><table width="100%" border="0"> <tr> <td> <!-- 'change the location from testedit.asp to editserver.asp to next --> <form name="form3" method="post" enctype="application/x-www-form-urlencoded" action="EditServerinfo/validate.asp" target="_self"> <div align="center"><!-- 'hidden session to copy row # to this page --> <input name=row type=hidden value=<%=request.QueryString("row")%>> <input name="Edit" type="submit" value="Edit"> </div> </form> </td> </tr></table></body></html><%Recordset1.Close()Set Recordset1 = Nothing%>
Link to comment
Share on other sites

There are a couple things I see. In your input fields like this:<input type="text" style="TEXT-TRANSFORM: uppercase; background:; WIDTH: 240px" value="<%=(Recordset1.Fields.Item("ServerName").Value)%>">You have an empty background property. I don't think that will mess anything up, but there's no point. Also, none of these input elements are inside a form.If you want to display a specific record, you include that in the query:Recordset1.Source = "SELECT * FROM SvrList WHERE id=" Request.Querystring("id")The problem is probably on the other pages.

Link to comment
Share on other sites

OK here is the code for the page before.......... when i click on 'view Record" i would like to the 'row' i click on ONLY data. like if i clik of object 4 "view record', I only want the next page to show me the record 4 data ONLY..However, it shows me 'row=4' in the address bar but the data from record 4 is not there and ONLY show record 1 no matter which one row/record i clik on....? :) <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!--#include file="Connections/SvrList.asp" --><%Dim Recordset1Dim Recordset1_numRowsSet Recordset1 = Server.CreateObject("ADODB.Recordset")Recordset1.ActiveConnection = MM_SvrList_STRINGRecordset1.Source = "SELECT * FROM SvrList ORDER BY ID ASC"Recordset1.CursorType = 0Recordset1.CursorLocation = 2Recordset1.LockType = 1Recordset1.Open()Recordset1_numRows = 0%><%Dim Repeat1__numRowsDim Repeat1__indexRepeat1__numRows = -1Repeat1__index = 0Recordset1_numRows = Recordset1_numRows + Repeat1__numRows%><%' *** Recordset Stats, Move To Record, and Go To Record: declare stats variablesDim Recordset1_totalDim Recordset1_firstDim Recordset1_last' set the record countRecordset1_total = Recordset1.RecordCount' set the number of rows displayed on this pageIf (Recordset1_numRows < 0) Then Recordset1_numRows = Recordset1_totalElseif (Recordset1_numRows = 0) Then Recordset1_numRows = 1End If' set the first and last displayed recordRecordset1_first = 1Recordset1_last = Recordset1_first + Recordset1_numRows - 1' if we have the correct record count, check the other statsIf (Recordset1_total <> -1) Then If (Recordset1_first > Recordset1_total) Then Recordset1_first = Recordset1_total End If If (Recordset1_last > Recordset1_total) Then Recordset1_last = Recordset1_total End If If (Recordset1_numRows > Recordset1_total) Then Recordset1_numRows = Recordset1_total End IfEnd If%><%' *** Recordset Stats: if we don't know the record count, manually count themIf (Recordset1_total = -1) Then ' count the total records by iterating through the recordset Recordset1_total=0 While (Not Recordset1.EOF) Recordset1_total = Recordset1_total + 1 Recordset1.MoveNext Wend ' reset the cursor to the beginning If (Recordset1.CursorType > 0) Then Recordset1.MoveFirst Else Recordset1.Requery End If ' set the number of rows displayed on this page If (Recordset1_numRows < 0 Or Recordset1_numRows > Recordset1_total) Then Recordset1_numRows = Recordset1_total End If ' set the first and last displayed record Recordset1_first = 1 Recordset1_last = Recordset1_first + Recordset1_numRows - 1 If (Recordset1_first > Recordset1_total) Then Recordset1_first = Recordset1_total End If If (Recordset1_last > Recordset1_total) Then Recordset1_last = Recordset1_total End IfEnd If%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Server Information</title></head><body><table width="100%" border="0" bordercolor="#990000" bgcolor="#990000"> <tr> <td width="34%" align="left" valign="middle" bgcolor="#990000"><img src="duke_energy.bmp"></td> <td width="66%" align="center" valign="middle" bgcolor="#990000"><h1 align="left"><font color="#FFFFFF" size="+2">DPIT Team Server Information</font></h1></td> </tr></table><table width="100%" height="70" border="0" bordercolor="#CCCCCC" bgcolor="#CCCCCC"> <tr> <td><table width="823" border="0" align="center"> <tr><td width="29%"> <form name="form1" method="post" enctype="application/x-www-form-urlencoded" form action="svrsearch.asp" target="_self"> Server Search: <label> <input name="textfield" type="text" value="Disabled"> </label> </form> </td> <td width="28%"> <form name="form2" method="post" enctype="application/x-www-form-urlencoded" action="/SQL05/serverinfo.asp" target="_self"> <div align="center"><br> <input name="Submit" type="submit" value="Home"> </div> </form> </td> <td width="43%"><div align="right"> <form name="form3" method="post" action="addserver.asp"> <label> <div align="center"><a href="AddServer2DB/addserver.asp">Add Server Record</a></div> </label> </form> </div></td> </tr></table> </td> </tr> <tr> <td>Server Total: <%=(Recordset1_total)%></td> </tr></table><table width="100%" border="0" align="center" bordercolor="#0033FF" bgcolor="#0033FF"> <tr bgcolor="#000033"> <td width="2%" bgcolor="#0033FF"></td> <td width="14%" bgcolor="#0033FF"><strong><font color="#FFFFFF">View Record</font></strong></td> <td width="8%" bgcolor="#0033FF"><strong><font color="#FFFFFF">OS </font></strong></td> <td width="16%" bgcolor="#0033FF"><strong><font color="#FFFFFF">Server Name </font></strong></td> <td width="17%" bgcolor="#0033FF"><strong><font color="#FFFFFF">Domain</font></strong></td> <td width="14%" bgcolor="#0033FF"><strong><font color="#FFFFFF">Network</font></strong></td> <td width="29%" bgcolor="#0033FF"><strong><font color="#FFFFFF">IP Address </font></strong></td> </tr></table><% While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) %> <table width="100%" height="37" border="0" align="center"> <tr> <td width="10%"><font color="#000000"><a href="vrecordsi.asp?row=<%=(Recordset1.Fields.Item("ID").Value)%>">View Record</a></font></td> <td width="14%"><div align="center"><%=(Recordset1.Fields.Item("OS").Value)%></div></td> <td width="16%"><%=(Recordset1.Fields.Item("ServerName").Value)%></td> <td width="17%"><%=(Recordset1.Fields.Item("Domain").Value)%></td> <td width="14%"><%=(Recordset1.Fields.Item("Network").Value)%></td> <td width="29%"><%=(Recordset1.Fields.Item("IP").Value)%></td> </tr> </table><% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 Recordset1.MoveNext()Wend%></body></html><%Recordset1.Close()Set Recordset1 = Nothing%>

Link to comment
Share on other sites

If you are getting the correct row id in the next page, but not able to display the correct row data, then you need to check the code of the second page. "view records" page seems to be working fine. Post the code of the next page. mostly thats where the error should be..

Link to comment
Share on other sites

You are getting all of the records, starting with record 1. That's why you see record 1:Recordset1.Source = "SELECT * FROM SvrList ORDER BY ID ASC"You're just getting everything. Try something like this:Recordset1.Source = "SELECT * FROM SvrList WHERE id=" & Request.Querystring("row")That code is not secure, but hopefully you get the idea.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...