Solved

redirecting a form to another page after it posts back to itself first

Posted on 2006-06-13
7
220 Views
Last Modified: 2011-09-20
I have a form that has code to collect some email addresses from input boxes, run some code to send a separate email to each of those addresses and then save the addresses to a database. The page posts back to itself now, but they want the customer to end up on a different page. I tried having the form post to page2 instead of page1, and it doesn't send the emails if I do that.
Is there a way to have page1 redirect to page2 after the code is run and the form submitted?
Thanks
0
Comment
Question by:jmestep
  • 3
7 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 150 total points
ID: 16898805
jmestep,

It would depend on the language or technology of the script (e.g. ASP, PHP, Perl).  You should be able to do it though.  In ASP (vbscript) it would be done by adding the line below after the email is sent.

   Response.Redirect "page2.asp"

If page2 needed some information then you could add a querystring or create session variables.  Let me know if you have questions or need more information.  If your page uses a different language/technology then please let us know which.  It would be most helpful for you to provide a copy of the code block where you want this to happen.

b0lsc0tt
0
 

Author Comment

by:jmestep
ID: 16898962
That worked great, once I put () around the page name. It's a .aspx page, but the code inside of it is more like .asp
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 16899319
Did you have any other questions related to this or did you need more information?  Let me know if you do.

The similarities between ASP and ASP.NET is the language used, vbscript.  I am not very familiar with ASP.NET but agree with what you said that they look alike.

bol
0
 
LVL 7

Expert Comment

by:SimonBlake
ID: 16900790
jmestep : you can test a postback if you are using .net quite easily.

<script runat="server">
Sub Page_Load()
  If Page.IsPostBack Then
    do stuff...
    redirect...
  End If
End Sub

Altho, this will require that your form tag also has a runat="server" in it as well for it to work.
Simon.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17109615
jmestep,

I'm glad that I could help you with the question you had.  However I think that you accepted my followup comment by accident instead of the comment (http:Q_21885437.html#16898805) that answered your question.  For the benefit of those that read the question in the future it would be good to correct this.  Pinaldave should be able to do that or help you do that.  Otherwise you can post a zero point question in the Community Support topic to get this corrected.  Let me know if you have any questions about this or please reply if there is some reason you do not want the comment I mentioned accepted.

Thank you for the grade, the points and the fun question.

bol
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now