472,114 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,114 software developers and data experts.

call post w/ classic asp

I've got a form that posts to itself when submitted.

Right now, after the form is submitted, the code checks that all of its
fields are valid, then processes the information. If all goes well, visitors
are then redirected using Response.Redirect("thanks.asp").

What I'd like to do is replace Response.Redirect("thanks.asp") with
something more like the post that happens on the form so that "thanks.asp"
can display a summary of what was submitted.

Is there a way to do this? Can you call a "post" somehow from Classic ASP?

I have not spent a lot of time with ASP, so it could be something simple!
Sep 19 '07 #1
7 17299
"jp2code" <poojo.com/mailwrote:
>I've got a form that posts to itself when submitted.

Right now, after the form is submitted, the code checks that all of its
fields are valid, then processes the information. If all goes well, visitors
are then redirected using Response.Redirect("thanks.asp").

What I'd like to do is replace Response.Redirect("thanks.asp") with
something more like the post that happens on the form so that "thanks.asp"
can display a summary of what was submitted.

Is there a way to do this? Can you call a "post" somehow from Classic ASP?
No. IMHO the best way to handle this is to store the data from the
form into the session object (Session("myvar")=whatever). Then the
page you forward to can retrieve the data from there and do whatever
it wants with it.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
http://members.cox.net/slatteryt
Sep 19 '07 #2

"jp2code" <poojo.com/mailwrote in message
news:%2*****************@TK2MSFTNGP04.phx.gbl...
I've got a form that posts to itself when submitted.

Right now, after the form is submitted, the code checks that all of its
fields are valid, then processes the information. If all goes well,
visitors are then redirected using Response.Redirect("thanks.asp").

What I'd like to do is replace Response.Redirect("thanks.asp") with
something more like the post that happens on the form so that "thanks.asp"
can display a summary of what was submitted.

Is there a way to do this? Can you call a "post" somehow from Classic ASP?
Instead of Response.Redirect, use Response.Write to summarise what was
submitted. Yes, it really is that simple.

<%
Sub showform
%>
<form method="post">
Your Name: <input type="text" name="FirstName" /><br />
<input type="submit" name="Submit" value="Submit" />
</form>
<%
End Sub

If Request.Form("Submit") = "" Then
call showform()
Else
If Len(Trim(Request.Form("FirstName")))>0 Then
Response.Write "Your name is " & Trim(Request.Form("FirstName"))
Response.Write "<br />Thanks!!"
Else
Response.Write "You forgot to enter your name"
call showform()
End If
End If
%>

--
Mike Brind
Sep 19 '07 #3
Mr. Slattery:

Thanks! That was even easy to implement! I've already got it working.

A+

"Tim Slattery" wrote:
>
No. IMHO the best way to handle this is to store the data from the
form into the session object (Session("myvar")=whatever). Then the
page you forward to can retrieve the data from there and do whatever
it wants with it.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
http://members.cox.net/slatteryt

Sep 19 '07 #4
instead of redirecting, you can use "server.execute". When you need to process that code, use :

server.execute("thanks.asp")

the "thanks.asp" file will have use of all information in the request object.
"jp2code" <poojo.com/mailwrote in message news:%2*****************@TK2MSFTNGP04.phx.gbl...
I've got a form that posts to itself when submitted.

Right now, after the form is submitted, the code checks that all of its fields are valid, then processes the information. If all
goes well, visitors are then redirected using Response.Redirect("thanks.asp").

What I'd like to do is replace Response.Redirect("thanks.asp") with something more like the post that happens on the form so that
"thanks.asp" can display a summary of what was submitted.

Is there a way to do this? Can you call a "post" somehow from Classic ASP?

I have not spent a lot of time with ASP, so it could be something simple!

Sep 19 '07 #5
So, lots of different tricks for doing the same thing! I like it!

"Jon Paal [MSMD]" pointed out:
instead of redirecting, you can use "server.execute". When you need to
process that code, use :

server.execute("thanks.asp")

the "thanks.asp" file will have use of all information in the request
object.

Sep 19 '07 #6
"jp2code" wrote:
So, lots of different tricks for doing the same thing! I like it!
Can you stand another? There is also Server.Transfer:
http://msdn2.microsoft.com/en-us/library/ms525800.aspx

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Sep 19 '07 #7
Gazing into my crystal ball I observed "jp2code" <poojo.com/mail>
writing in news:#e*************@TK2MSFTNGP04.phx.gbl:
I've got a form that posts to itself when submitted.

Right now, after the form is submitted, the code checks that all of
its fields are valid, then processes the information. If all goes
well, visitors are then redirected using
Response.Redirect("thanks.asp").

What I'd like to do is replace Response.Redirect("thanks.asp") with
something more like the post that happens on the form so that
"thanks.asp" can display a summary of what was submitted.

Is there a way to do this? Can you call a "post" somehow from Classic
ASP?

I have not spent a lot of time with ASP, so it could be something
simple!

The way I deal with this is this:
1. Start the page off with issubmitted = false
2. Validate and do whatever posting to db I need to do.
3. Change issubmitted to true

HTML is something like:
<% if not issubmitted then%>
<form method="post" action="<%=request.servervariables("Script_name")% >">
<div>
<label for="name" id="name1">Name:</label<input type="text" name="name"
value="<%=name%>" id="name"><br>
<input type="submit" value="Submit">
</form>
<%else%>
<p>Thank you for submitting the information below:</p>
<dl>
<%For ix = 1 to Request.Form.Count
field = request.form.key(ix)
inputvalue = request.form.item(ix)%>
<dt><%=field%></dt>
<dd><%=inputvalue%></dd>
<%next%>
</dl>
<%end if%>

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Sep 21 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by paulette | last post: by
2 posts views Thread by Rob Shorney | last post: by
7 posts views Thread by MeAgin | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.