Using Form results in anotherASP page

  • Thread starter Thread starter [Sinan]
  • Start date Start date
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
 
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
 
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.
==============================================
 
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?
 
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.
==============================================
 
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?
 
Thomas,

Sorry, but didn't understand what you advise. Could you make it clearer pls?
 
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.
==============================================
 
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.
==============================================
 
Didn't work. It pops up the destination window but I cannot move any value.
Any more suggestions?
 
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
 
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:;"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top