Go To Detail Page Passing Values but not getting picked up correctly on Detail Page

Hi Guys,
I have two pages the first called main_view.asp and the second is called Sub_View.asp i am using repated regions on both pages.

on the main_view.asp page i am using a "Go To Detail Page" link to link to Sub_View.asp im passing the CATID to this page to select everything from the table tblSubCat where the ID is equal to 3 for example, depending on which category the user selects on main_view.asp.

the SQL bit works, and when i test it in the recordset window in the dreamweaver it works, BUT when i go to my browser and test it, it keeps returning back the first record in the database everytime! no matter what link i click, even though in the browser address bar the URL changes eg: http://mysite/Sub_View.asp?CatID=3 

please help!

Thanks
Jay Eire
(<>..<>)


************************************ Main View ************************************

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/DB_Connect.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_DB_Connect_STRING
Recordset1.Source = "SELECT * FROM dbo.tblCat ORDER BY CatDesc ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Main View</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
  <tr bgcolor="#CCCCCC">
    <td><strong><font color="#666666">ID</font></strong></td>
    <td><strong><font color="#666666">Description</font></strong></td>
    <td><font color="#666666">&nbsp;</font></td>
  </tr>
  <%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
  <tr>
    <td width="18%"><%=(Recordset1.Fields.Item("CatID").Value)%></td>
    <td width="65%"><%=(Recordset1.Fields.Item("CatDesc").Value)%></td>
    <td width="17%"><A HREF="sub_view.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "CatID=" & Recordset1.Fields.Item("CatID").Value %>">View</A></td>
  </tr>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>




************************************ Sub View ************************************
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/DB_Connect.asp" -->
<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("CatFID") <> "") Then
  Recordset2__MMColParam = Request.QueryString("CatFID")
End If
%>
<%
Dim Recordset2
Dim Recordset2_numRows

Set Recordset2 = Server.CreateObject("ADODB.Recordset")
Recordset2.ActiveConnection = MM_DB_Connect_STRING
Recordset2.Source = "SELECT * FROM dbo.tblSubCat WHERE CatFID = " + Replace(Recordset2__MMColParam, "'", "''") + " ORDER BY SubCatDesc ASC"
Recordset2.CursorType = 0
Recordset2.CursorLocation = 2
Recordset2.LockType = 1
Recordset2.Open()

Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset2_numRows = Recordset2_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Sub View</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
  <tr bgcolor="#CCCCCC">
    <td><strong><font color="#666666">SubID</font></strong></td>
    <td><strong><font color="#666666">Sub Description</font></strong></td>
    <td><font color="#666666">&nbsp;</font></td>
  </tr>
  <%
While ((Repeat1__numRows <> 0) AND (NOT Recordset2.EOF))
%>
  <tr>
    <td><%=(Recordset2.Fields.Item("SubCatID").Value)%></td>
    <td><%=(Recordset2.Fields.Item("SubCatDesc").Value)%></td>
    <td>View</td>
  </tr>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset2.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
LVL 7
jay_eireAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rockmansatticCommented:
You are useing two different variabls

change sub_page

<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("CatFID") <> "") Then
  Recordset2__MMColParam = Request.QueryString("CatFID")
End If
%>

to

<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("CatID") <> "") Then
  Recordset2__MMColParam = Request.QueryString("CatID")
End If
%>

******OR****
main_page

"><A HREF="sub_view.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "CatID=" & Recordset1.Fields.Item("CatID").Value %>">View</A>

to

"><A HREF="sub_view.asp?<%= MM_keepURL & MM_joinChar(MM_keepURL) & "CatFID=" & Recordset1.Fields.Item("CatID").Value %>">View</A>

Rockman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rockmansatticCommented:
your main page is sending a CatID, but your sub_page is looking for CatDIF.


rockman
0
jay_eireAuthor Commented:
yes i know, its ment to do that CATFID is the foreign key to CATID.......
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

rockmansatticCommented:
No..
the sub page is searching the database with the wrong variable.
the url var is CatID
the searching var is CatFID

when you get to the sub page, since there is NO CATFID variable, the default is 1, which is why you are getting the first record every time.

change the url to this and see

http://mysite/Sub_View.asp?CatFID=3 

Rockman
0
jay_eireAuthor Commented:
my fault, i see what your getting at now, thank for your help man!
0
rockmansatticCommented:
no problem, sometimes it is hard to explain without moving may hands wildly in the air.

Rockman
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.