Solved

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

Posted on 2006-06-13
7
225 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

707 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