Using Form results in anotherASP page

S

[Sinan]

I am trying to figure out how to transfer a value from one page to another.
Let's say, I have one hidden input in send.asp page gathered using a form
handler. When submitted the form, I want either display and use it as input
in another form in receive.asp page. What would be the codes on both page? I
would greatly appreciate any input.

Thanks,

Sinan
 
J

Jon Spivey

Hi Sinan,
you'd probably use server.transfer,eg
page1.asp
<input type="hidden" name="txt" value="something">
form submits to page2.asp
response.write request.form("txt")
server.transfer "page3.asp"
response.write request.form("txt")

Notice that as you move to the next page the form values are maintained

Jon
Microsoft MVP
 
T

Thomas A. Rowe

On the first page that you past the value to do:

<%
Session("name") = request.form("name")
%>

Then on the page that generates the Excel output

<%
name = Session("name")
%>

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
S

[Sinan]

Thank you !!

It looks like this now:

page1 :

<form method="post" action="page2.asp">

<input type="hidden" name="txt" value="123">
<input type="submit" value="Submit" name="B1">
</form>

page2 :

<form method="post" action="--WEBBOT-SELF--"
<!--webbot bot="SaveDatabase" ....
<input type="hidden" name="name1" size="64" value="<% response.write
request.form("txt") %>" maxlength="255">

Using form in page2, I write the data into database correctly. Thank you.

Just a small question more. What if I want page2.asp to popup. I tried to
insert the below code as Action command in page1 but didn't work :

action=<a href="#"
onClick="MyWindow1=window.open(page2.asp','MyWindow2','toolbar=no,location=n
o,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=300,
height=200'); return false;">

It pops up the page2 but doesn't carry out the value. It's null. Any advice?
 
T

Thomas A. Rowe

Try:

action=<a href="#"
onClick="MyWindow1=window.open(page2.asp?txt=<%=request.form("txt")%>','MyWi
ndow2','toolbar=no,location=n
o,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=300,
height=200'); return false;">

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
S

[Sinan]

Thomas,

I actually have more than one inputs in page1 form. So how can I move all
values in one submit to the pop up page2?
 
S

[Sinan]

Thomas,

Sorry, but didn't understand what you advise. Could you make it clearer pls?
 
T

Thomas A. Rowe

You need to store the value from the first form, in a session on the page
that you submit the form to, so that you can use it later

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
T

Thomas A. Rowe

action=<a href="#"
onClick="MyWindow1=window.open(page2.asp?txt=<%=request.form("txt")%>&txt1=<
%=request.form("txt1")%>','MyWi
ndow2','toolbar=no,location=n
o,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=300,
height=200'); return false;">


--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
S

[Sinan]

Didn't work. It pops up the destination window but I cannot move any value.
Any more suggestions?
 
J

Jon Spivey

Hi,
you'd want to loop through your form fields and add each name/value to the
url, eg
<%
for i = 1 to request.form.count
strFields = strFields & request.form.key(i) & "=" & request.form.item(i) &
"&"
next
strFields = server.urlencode(right(strFields, len(strFields)-1))
%>
now we can build the window link
<a href="javascript:;"
onclick="MyWindow1=window.open('page2.asp?<%=strFields%>','width=300,height=
200'); return false;">

Jon
Microsoft MVP - FP
 
S

[Sinan]

No. I couldn't get it run. Damn!

Thank you,

Sinan

Jon Spivey said:
Hi,
you'd want to loop through your form fields and add each name/value to the
url, eg
<%
for i = 1 to request.form.count
strFields = strFields & request.form.key(i) & "=" & request.form.item(i) &
"&"
next
strFields = server.urlencode(right(strFields, len(strFields)-1))
%>
now we can build the window link
<a href="javascript:;"
 
Top