SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    0 Post(s)
    0 Thread(s)

    Passing form variables 2 or 3 pages forward

    Here is the scene. I have a shopping basket that is cookie driven but on that page I have a discount word form. When you put a correct discount word it kicks this off on the same page and the discount values are calculated in the cookie javascript

    <%Dim search1
    If Request.Form("searchstring1") <> "" Then
    **Database connection stuff here**
    	set rs=conn.execute("SELECT * FROM discount where discountword = '" & search1 & "'")
    	If Not rs.EOF Then
    		Session("DiscountAmount") = rs("discountamount")
    		Session("DiscountValue") = rs("discountvalue")
    		Session("Discountword") = rs("discountword")
    	End If
    End If
    If Session("DiscountValue") = "" Then Session("DiscountValue") = "1"
    If Session("DiscountAmount") = "" Then Session("DiscountAmount") = "0"
    You then go to checkout to put your name and address in and pick PAY, your get directed to a secure page to put cc details in. Once you have your order is added to a MySQL database. I need the discount word to appear in the MySQL database as well but this is inserted 2 or 3 pages after the discount word.

    In the example about I have (wrongly or rightly) set it is a session variable. How do I use this on the page that is submitting to the MySQL db? As it's a session can I just use a <INPUT TYPE="hidden" NAME=" etc as normal or do I have to do something to jump the variable on across the page?

    Please help.

  2. #2
    SitePoint Evangelist comfixit's Avatar
    Join Date
    Dec 2004
    0 Post(s)
    0 Thread(s)
    Session variables should be persistent and accessible across the entire session. In other words you should be able to access the session varriable without a problem 2 or 3 pages out. As long as the time has not expired for that particular session.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts