Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error email attachment VB2010 5 32
Google adds suggestions 3 58
How to translate path in URL with PHP? 11 38
Element alignment and word wrapping 9 61
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 …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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)

896 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

11 Experts available now in Live!

Get 1:1 Help Now