Response.Redirect & URL Variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jschrader
    New Member
    • Mar 2008
    • 8

    Response.Redirect & URL Variable

    Sorry that I'm reposting, but this topic is in an archive that I can't post to.

    I am having a problem that I can not figure out...

    I have a ASP form page /Quiz.asp that processes the form itself. and then has a redirect to a Confirmation.as p page I am trying to figure out how to pass off the PK_ID from the new record being create in the database to the new confirmation page so that they can see some of their information and quiz answers.

    Below is the code, please let me know if you have any questions to better answer my question

    Quiz.asp
    Code:
    sql="INSERT INTO ITQA(FName, LName, Email) VALUES('" & _
    			Request("firstname") & "', '" & Request("lastname") & _
    			"', '" & Request("email") & _
    		
    	End Select
    	cn.Execute sql		
    	
    	Response.Clear
    	Response.Redirect "IT_QandA_Confirm.asp?ID="& Request("ID")
    end if
    %>
    <BODY>
    <form action="Quiz.asp" method="post">
    <input type="hidden" name="ID" value=<%=Request("ID")%>>
    <table>
     <tr>
      <th>Name :</th>
      <td><input type="text" name="firstname" value="">
        <input type="text" name="lastname" value=""></nobr></td>
     </tr>
     <tr>
       <th >Email Address:</th>
       <td><input type="text" name="email" value=""></td>
    Confirmation page (ive tried a couple different ways, but just need the ID to be passed along with it to pull up specific info)
    Code:
    <%
    'Confirmation Form
    
    Response.Write	"<HTML><Body>
    <P>Thank you for taking our little quiz...<P>" &_
    "Your entry will be put into our system and all of the top scores will be put into a drawing" &_
    "<b>Submitted By: </b>" + Request.Form("firstname") + " " + Request.Form("lastname") + "<br>" &_
    "<b>E-mail: </b>" + Request.Form("email") + "<BR>" &_
    "<a href=Quiz_Answers.asp?ID=" + Request.Form("PK_ID") + " >Check out your score here.</a></body></html>"
    %>
  • jschrader
    New Member
    • Mar 2008
    • 8

    #2
    I'm sure that I am missing something in calling the ID in the sql statement at the begining just to have the variable to redirect, but I can't figure out where it belongs...

    Comment

    • idsanjeev
      New Member
      • Oct 2007
      • 241

      #3
      I jschrader

      just redirect on url "IT_QandA_Confi rm.asp"
      [code=asp]
      Response.Redire ct "IT_QandA_Confi rm.asp"
      [/code]

      and store his id in cookies or session
      select data acording to his id on confirm page to display

      thanks

      Comment

      • jschrader
        New Member
        • Mar 2008
        • 8

        #4
        Example?
        I'd like to keep it all in the asp code and not use cookie's if possible? Sorry, not an expert ASP developer by any means...

        Originally posted by idsanjeev
        I jschrader

        just redirect on url "IT_QandA_Confi rm.asp"
        [code=asp]
        Response.Redire ct "IT_QandA_Confi rm.asp"
        [/code]

        and store his id in cookies or session
        select data acording to his id on confirm page to display

        thanks

        Comment

        • jhardman
          Recognized Expert Specialist
          • Jan 2007
          • 3405

          #5
          Originally posted by jschrader
          Example?
          I'd like to keep it all in the asp code and not use cookie's if possible? Sorry, not an expert ASP developer by any means...
          session variables are just a useful way to pass data from one page to another within the same site: [code=asp]session("ID") = request("ID")[/code]Once you put that line in a page the user visits (probably on the login confirmation page, right?) it is accessible from any page on your site. Let me know if htis helps.

          Jared

          Comment

          Working...