Get data from previous page and insert it into a new table layout.

Hello,

I need to pull data from the tables on a page and reinsert them into a new layout on my second page. How would I go about doing this?

Reade
Madmuda1Asked:
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.

hongjunCommented:
How do you get the data to display on the first page?
By a ID?

Then you can do something like this to pass the ID to the second page and then do a db call to display data.

First_Page
---

<form action="second_page.asp" method="post">
<input type="hidden" name="hdnID" value="1">
<input type="submit" value="Go to Second Page">
</form>


Second_Page
---

Use the passed ID value to get db value.

<%
''' I am displaying to show how to get the passed ID
Response.Write Request.Form("hdnID")
'''''

%>
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
Madmuda1Author Commented:
That is the method I have been seeing on my searches but I am confused as to how I specify the name that is to be posted.

<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="../project_tracking/florida/tampa/Connections/eventlistingmanager.asp" -->
<%
set Category = Server.CreateObject("ADODB.Recordset")
Category.ActiveConnection = MM_eventlistingmanager_STRING
Category.Source = "SELECT tblEventCategory.CategoryID, tblEventCategory.CategoryName  FROM tblEventListings INNER JOIN tblEventCategory ON tblEventListings.CategoryID = tblEventCategory.CategoryID  GROUP BY tblEventCategory.CategoryID, tblEventCategory.CategoryName"
Category.CursorType = 0
Category.CursorLocation = 2
Category.LockType = 3
Category.Open()
Category_numRows = 0
%>
<%
Dim eventlist__MMColParam1
eventlist__MMColParam1 = "%"
If (Request.Form("search") <> "") Then
  eventlist__MMColParam1 = Request.Form("search")        
End If
%>
<%
Dim eventlist__MMColParam2
eventlist__MMColParam2 = "%"
If (Request.QueryString("ItemID")  <> "") Then
  eventlist__MMColParam2 = Request.QueryString("ItemID")
End If
%>
<%
Dim eventlist__MMColParam3
eventlist__MMColParam3 = "%"
If (Request.Form("searchcat")  <> "") Then
  eventlist__MMColParam3 = Request.Form("searchcat")
End If
%>
<%
set eventlist = Server.CreateObject("ADODB.Recordset")
eventlist.ActiveConnection = MM_eventlistingmanager_STRING
eventlist.Source = "SELECT tblEventListings.*, tblEventCategory.CategoryDesc, tblEventCategory.CategoryName  FROM tblEventCategory INNER JOIN tblEventListings ON tblEventCategory.CategoryID = tblEventListings.CategoryID  WHERE tblEventCategory.CategoryName Like '" + Replace(eventlist__MMColParam3, "'", "''") + "'  AND tblEventListings.ItemID Like '" + Replace(eventlist__MMColParam2, "'", "''") + "' AND (tblEventListings.ItemDesc Like '%" + Replace(eventlist__MMColParam1, "'", "''") + "%' OR tblEventListings.ItemName Like '%" + Replace(eventlist__MMColParam1, "'", "''") + "%' OR tblEventListings.EventLocation Like '%" + Replace(eventlist__MMColParam1, "'", "''") + "%' )   ORDER BY EventStartDate DESC"
eventlist.CursorType = 0
eventlist.CursorLocation = 2
eventlist.LockType = 3
eventlist.Open()
eventlist_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
eventlist_numRows = eventlist_numRows + Repeat1__numRows
%>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {font-size: 16px}
.style2 {
      font-size: 14;
      font-weight: bold;
}
-->
</style>
<head>
<title>UES Project Tracking</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<link href="../styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<!--#include file="header.asp" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="24" class="tableborder">
  <tr>
    <td height="24" width="31%" valign="baseline"><form action="" method="post" name="form2" id="form2">
       
        <div align="right">
          <% If Not Category.EOF Or Not Category.BOF Then %>
            <div align="left">Search by Status
              <select name="searchcat" id="select" >
                <option selected value="%" <%If (Not isNull(Request.Form("search"))) Then If ("xyz" = CStr(Request.Form("search"))) Then Response.Write("SELECTED") : Response.Write("")%>>Show All</option>
                <%
While (NOT Category.EOF)
%>
                <option value="<%=(Category.Fields.Item("CategoryName").Value)%>" <%If (Not isNull(Request.Form("search"))) Then If (CStr(Category.Fields.Item("CategoryName").Value) = CStr(Request.Form("search"))) Then Response.Write("SELECTED") : Response.Write("")%> ><%=(Category.Fields.Item("CategoryName").Value)%></option>
                <%
  Category.MoveNext()
Wend
If (Category.CursorType > 0) Then
  Category.MoveFirst
Else
  Category.Requery
End If
%>
              </select>
              <input name="submit2" type="submit" value="Go">
            </div>
            <% End If ' end Not Category.EOF Or NOT Category.BOF %>
        </div>
    </form></td>
    <td width="31%" valign="baseline">Sort by: Date <a href="list_sort_desc.asp"><img src="images/arrow_dn.gif" alt="Descending" width="10" height="13" border="0"></a> | <a href="list_sort_location.asp">Location</a> | <a href="list_sort_contractor.asp">Contractor</a> | <a href="list_sort_distributor.asp">Distributor</a> | <a href="list_sort_rep.asp">Rep</a> | <a href="list_sort_ues.asp">UES# </a></td>
    <td height="24" width="38%" valign="baseline"><form name="form" method="post" action="">
        <div align="center">Search by Keyword
            <input name="search" type="text" id="search">
            <input type="submit" value="Go" name="submit">
        </div>
    </form></td>
  </tr><form name="form1" method="post" action="">
  <%
While ((Repeat1__numRows <> 0) AND (NOT eventlist.EOF))
%>
  <% If Not eventlist.EOF Or Not eventlist.BOF Then %>
</table>
<table width="100%" height="94" border="0" cellpadding="1" cellspacing="1" class="tableborder">
  <tr class="tableheader">
    <td><div align="center" class="menu">UES#</div></td>
    <td>Status:</td>
    <td width="12%" height="19">Date:</td>
    <td width="12%">EZProject#:</td>
    <td width="13%">Project:</td>
    <td width="16%">Location:</td>
    <td width="14%"><p>Product:</p></td>
    <td width="13%">Value:</td>
    <td colspan="2">
    <div align="center" class="style1"><a href="view.asp?ItemID=<%=(eventlist.Fields.Item("ItemID").Value)%>"><img src="images/arrow_r.gif" alt="Details" width="13" height="10" border="0"></a></div></td>
  </tr>
  <tr>
    <td width="4%" rowspan="2"><span class="style2"><%=(eventlist.Fields.Item("ItemID").Value)%>.</span></td>
    <td width="12%"><%=(eventlist.Fields.Item("CategoryName").Value)%></td>
    <td><%=(eventlist.Fields.Item("EventStartDate").Value)%></td>
    <td><%=(eventlist.Fields.Item("ItemName").Value)%></td>
    <td><%=(eventlist.Fields.Item("ItemDesc").Value)%></td>
    <td><%=(eventlist.Fields.Item("ItemDescShort").Value)%></td>
    <td height="24"><%=(eventlist.Fields.Item("EventLocation").Value)%></td>
    <td height="24"><%=(eventlist.Fields.Item("LocationMap").Value)%></td>
    <td width="4%" rowspan="3"><div align="center"><a href="update.asp?ItemID=<%=(eventlist.Fields.Item("ItemID").Value)%>"><img src="images/edit.jpg" alt="Edit" width="16" height="16" border="0"></a> | <a href="delete.asp?ItemID=<%=(eventlist.Fields.Item("ItemID").Value)%>"><img src="images/delete.jpg" alt="Delete" width="16" height="16" border="0"></a> </div>
        <div align="center"></div></td>
  </tr>
  <tr class="<%
RecordCounter = RecordCounter + 1
If RecordCounter Mod 2 = 1 Then
Response.Write "row1"
Else
Response.Write "row2"
End If
%>">
    <td height="13" colspan="3" class="tableheader"><strong>Notes:</strong></td>
    <td class="tableheader"><strong>Contractor:</strong></td>
    <td class="tableheader"><strong>Distributor:</strong></td>
    <td height="13" class="tableheader"><strong>Engineer:</strong></td>
    <td height="13" class="tableheader">Update:</td>
  </tr>
  <tr class="<%
RecordCounter = RecordCounter + 1
If RecordCounter Mod 2 = 1 Then
Response.Write "row1"
Else
Response.Write "row2"
End If
%>">
    <td width="4%"><strong class="tableheader"><%=(eventlist.Fields.Item("UnitOfMeasure").Value)%></strong></td>
    <td height="13" colspan="3"><%=(eventlist.Fields.Item("Feature5").Value)%></td>
    <td><%=(eventlist.Fields.Item("EventPresenter").Value)%></td>
    <td><%=(eventlist.Fields.Item("Feature1").Value)%></td>
    <td height="13"><%=(eventlist.Fields.Item("Feature2").Value)%></td>
    <td height="13"><%=(eventlist.Fields.Item("Feature4").Value)%></td>
  </tr><br>
</table>
 
    <input type="hidden" name="hiddenField">
  </form>
  <% End If ' end Not eventlist.EOF Or NOT eventlist.BOF %>
  <%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  eventlist.MoveNext()
Wend
%>

<% If eventlist.EOF And eventlist.BOF Then %>
<% End If ' end eventlist.EOF And eventlist.BOF %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div align="center"></div></td>
  </tr>
</table>
</body>
</html>
<%
Category.Close()
Set Category = Nothing
%>
<%
eventlist.Close()
Set eventlist = Nothing
%>
<SCRIPT language=Javascript1.2>
<!--

var message = "Print this Page";

function printpage() {
window.print();  
}

document.write("<form><input type=button "
+"value=\""+message+"\" onClick=\"printpage()\"></form>");

//-->
</SCRIPT>
Print landscape for best results.
0
ThinkPaperIT ConsultantCommented:
Your firstpage should have a form or link to go to second page:
<a href="secondpage.asp?id=<%=myID%>">Next Page</a>

So when you head to the second page, your URL looks something like:
secondpage.asp?id=5

Grab the id value:
<%
dim myID
myID = Request("id")
%>

Run your query:
<%
myQuery ="SELECT blah from BLAH where ID =" & myID
%>

and display your stuff.

If you need to pass more than one variable, just use an ampersand to attach the values to your URL

secondpage.asp?id=5&name=Bob&startdate=3/2/2006
<%
'grab the values
myID = Request("id")
myName= Request("name")
myDate = Request("startdate")
%>

Is this what you were looking for?
0
Madmuda1Author Commented:
Well the page that I am pulling from has multiple tables with different data. And I need to pull all of it to the next page.
0
ThinkPaperIT ConsultantCommented:
There's no easy way that I know of to pass a whole bunch of info over without using forms or some sort of ID to do a query pull. The best way is to do what hongjun stated. You'll need to do the same query you did on the first page on the second page and display it however you like.
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
ASP

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.