Solved

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

Posted on 2006-06-13
7
222 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

809 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