Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-03-22
7
Medium Priority
?
219 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:Madmuda1
  • 2
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 1000 total points
ID: 16258678
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
 

Author Comment

by:Madmuda1
ID: 16258743
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
 
LVL 16

Assisted Solution

by:ThinkPaper
ThinkPaper earned 1000 total points
ID: 16259031
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
 

Author Comment

by:Madmuda1
ID: 16259167
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
 
LVL 16

Expert Comment

by:ThinkPaper
ID: 16446136
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month21 days, 4 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question