By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,573 Members | 903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,573 IT Pros & Developers. It's quick & easy.

Displaying Form Data on a Confirmation Page

P: 1
Hi

I am using ASP and HTML to process a form. The first form calls another page to process the data. When the page processes it redirects to a page confirming submission. I want to display the data entered by the user on the confirmation page.

Could someone shed any light on how to link the pages and do this. All I can find out about is displaying information that is inserted into a database which is not relevant.

This is the code to process my form...
Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <%
  3. Option Explicit
  4. %>
  5. <%
  6.  
  7. ' declare variables
  8. Dim EmailFrom
  9. Dim EmailTo
  10. Dim Subject
  11. Dim Name
  12. Dim Email
  13. Dim Telephone
  14. Dim Location
  15.  
  16. ' get posted data into variables
  17. EmailFrom = Trim(Request.Form("Email")) 
  18. EmailTo = "alixcoleby@googlemail.com, " & Trim(Request.Form("Email"))
  19. Subject = "Reservation Request"
  20. Name = Trim(Request.Form("Name")) 
  21. Email = Trim(Request.Form("Email")) 
  22. Telephone = Trim(Request.Form("Telephone")) 
  23. Location = Trim(Request.Form("Location")) 
  24.  
  25. ' prepare email body text
  26. Dim Body
  27. Body = Body & "Hotel Reservation Enquiry" & VbCrLf
  28.  
  29. Body = Body & "Name: " & Name & VbCrLf
  30. Body = Body & "Email: " & Email & VbCrLf
  31. Body = Body & "Telephone: " & Telephone & VbCrLf
  32. Body = Body & "Location: " & Location & VbCrLf
  33.  
  34. ' send email 
  35. Dim mail
  36. Set mail = Server.CreateObject("CDONTS.NewMail") 
  37. mail.To = EmailTo
  38. mail.From = EmailFrom
  39. mail.Subject = Subject
  40. mail.Body = Body
  41. mail.Send 
  42.  
  43. ' redirect to success page 
  44. Response.Redirect "ok.htm"
  45. ' Response.Redirect("ok.htm" & EmailFrom)
  46. %>
Jan 7 '08 #1
Share this Question
Share on Google+
1 Reply


jhardman
Expert 2.5K+
P: 3,405
It's easiest if you don't redirect, then at the end you can just say:
Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <%
  3. Option Explicit
  4. %>
  5. <%
  6.  
  7. ' declare variables
  8. Dim EmailFrom
  9. Dim EmailTo
  10. Dim Subject
  11. Dim Name
  12. Dim Email
  13. Dim Telephone
  14. Dim Location
  15.  
  16. ' get posted data into variables
  17. EmailFrom = Trim(Request.Form("Email")) 
  18. EmailTo = "alixcoleby@googlemail.com, " & Trim(Request.Form("Email"))
  19. Subject = "Reservation Request"
  20. Name = Trim(Request.Form("Name")) 
  21. Email = Trim(Request.Form("Email")) 
  22. Telephone = Trim(Request.Form("Telephone")) 
  23. Location = Trim(Request.Form("Location")) 
  24.  
  25. ' prepare email body text
  26. Dim Body
  27. Body = Body & "Hotel Reservation Enquiry" & VbCrLf
  28.  
  29. Body = Body & "Name: " & Name & VbCrLf
  30. Body = Body & "Email: " & Email & VbCrLf
  31. Body = Body & "Telephone: " & Telephone & VbCrLf
  32. Body = Body & "Location: " & Location & VbCrLf
  33.  
  34. ' send email 
  35. Dim mail
  36. Set mail = Server.CreateObject("CDONTS.NewMail") 
  37. mail.To = EmailTo
  38. mail.From = EmailFrom
  39. mail.Subject = Subject
  40. mail.Body = Body
  41. mail.Send 
  42.  
  43. ' instead of redirecting to success page %>
  44. <html><head><title></title></head><body><p>Form was submitted and processed correctly.
  45.  
  46. <p>The following was submitted:<ol>
  47. <%
  48. for each x in request.form %>
  49.    <li><%=x & ": " & request(x)%></li>
  50. <%
  51. next %>
  52. </ol>
  53. The data was emailed to a responsible person who will now share your secrets with the entire world wide web.
  54. </body>
Otherwise you can save the data as session variables before you redirect
Expand|Select|Wrap|Line Numbers
  1. session("emailFrom") = EmailFrom
then on the confirmation page you can pull them up
Expand|Select|Wrap|Line Numbers
  1. <p>Email address: <%=session("emailFrom")%>
Let me kow if this helps.

Jared
Jan 8 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.