Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing values to pop-up window

Status
Not open for further replies.

Richey

Technical User
Aug 29, 2000
121
GB
I have 4 asp pages - 3 of which data is populated by the user. on the proceed of pages 1 - 3, the values are carried across as hidden values - so on the 4th page, called Submit.asp. the following is written.
I've added a link called, Print Form, which when clicked opens a pop-up window on top of submit.asp
I want this asp page to display all the populated fields in basic text, so it can be printed out (without headers/images etc)
Can I use request.form? I didn't think so as there are no form tags within submit.asp
How can I show the field values then?

any help much appreciated
Brian

<%
Dim myConn
Dim SQLString

Set myConn = Server.CreateObject(&quot;ADODB.Connection&quot;)

connStr = &quot;DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&quot; & server.mappath(&quot;nameofdatabase&quot;)
myConn.Open connStr,&quot;&quot;,&quot;&quot;

SQLString = &quot;INSERT INTO nameoftable (&quot;

For each Field in Request.Form
SQLString = SQLString & Field & &quot;, &quot;
Next

SQLString = Left(SQLString, (Len(SQLString) -2))

SQLString = SQLString + &quot;) VALUES (&quot;

For each Field in Request.Form
StrValue = Request.Form(Field)
SQLString = SQLString + &quot;'&quot; & Request(Field) & &quot;', &quot;
Next

SQLString = Left(SQLString, (Len(SQLString) -2))
SQLString = SQLString + &quot;);&quot;
response.write SQLString
myConn.Execute(SQLString)

 
see when you open a pop up window, just pass a basic value of all records(Primary key) as a query string
as

window.open &quot;WindowName.asp?var1=<%=UniqueKey%>&quot;

so it will be passed as a querystring

Now in your pop up window, accept it by Request.Form and fire a sql command so that you can fetch values from database.

If key is composite, pass multiple values Or pass whatever required values to fetch records from the databse.

It would not be efficient to pass all values as querystring limit is 2000 bits

On the window onLoad, write

onLoad=window.print()

So on load only it will ask for printing.No need for a button.

Right !! Rushi Shroff Rushi@emqube.com
&quot;Life is beautiful.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top