Passing a variable to a new page's form field via hyperlink

Discussion in 'ASP General' started by Newbie, Jul 7, 2003.

  1. Newbie

    Newbie Guest

    OK, this may be impossible since I'm using 3rd party shopping cart ASP
    software, but I've been able to finagle a lot of other stuff I thought
    wouldn't work, so here we go:

    I'm using a form in which users enter numbers to be calculated into a square
    footage cost. Upon submitting, the results page uses ASP to give the total
    and the chance to add the new totalled item to the cart or try a new
    calculation. Part of the cart's software has a "returnURL" variable you can
    enter to tell what page will open up once the item is in the cart. I'm
    trying to open the new page with one form field that is already filled in
    with one variable that was set in the "add to cart" page. So far, I am
    unable to do it.

    Is it possible to fill in a form field with a variable passed from one page
    without using previous form fields or submit buttons? The reason I want the
    form field to use a previous variable's value is that the field, upon
    submission of the 3rd page's form, will populate an Access field.

    Here's the progression:

    - 1st page is a form where user enters company name and several numbers in
    fields for square footage calculation. Submit button goes to...
    - 2nd page: No form fields, just the totals and company name, etc. A
    hyperlink here uses the cart's syntax to add the order to the shopping cart.
    Part of the hyperlink includes the URL to open upon adding the item to the
    cart.
    - 3rd page: Another form where the user enters much more detailed info
    about the order into form fields, all of which populate an Access db. I
    would like to carry the CompanyName from the 2nd page to this one, and
    automatically enter that value in the CompanyName form field.

    Here's the ASP code of the 2nd page:

    <%
    Dim UpchargeA
    Dim Company


    ON ERROR RESUME NEXT
    response.write request("CompanyName")%>: Your preliminary cost, including
    upcharges, is:<br><br>



    <%
    ON ERROR RESUME NEXT
    response.write (((cInt(request("A1")) + cInt(request("A2")) +
    cInt(request("B")) + cInt(request("B2")))/cInt(request("C")))*1.645)
    +cInt(request("Upcharge"))
    %>br><br>
    Would you like to continue?&nbsp;
    <p><a href="1stPage.asp">NO, return to liner quote system</a> <br><br>

    <a href="ShoppingCartCodeThatAddsToCart.asp?Productname=Whatever&price=
    <%
    ON ERROR RESUME NEXT
    response.write (((cInt(request("A1")) + cInt(request("A2")) +
    cInt(request("B")) + cInt(request("B2")))/cInt(request("C")))*1.645) +
    cInt(request("Upcharge"))
    %>
    &quantity=1&returnurl=../3rdPage.asp">Yes, I would like to purchase this
    liner</a>


    It's the "3rdPage.asp" that is the cart's info for what new page to open
    upon placing the item in the cart. I tried using the
    ....asp?CompanyName=Whatever", and the corresponding ASP on the 3rd page to
    populate the "CompanyName" field, but it doesn't work.

    I am using FrontPage and little tidbits of asp that I'm gradually learning.
    If it helps, the 3rd Page is a FrontPage Form Results page that populates
    the db with all the given info upon clicking "Submit" (made by using the
    Send To wizard thingy).

    Thanks for any help, it is much appreciated.

    PS: If the above code seems very cumbersome and can be streamlined, please
    feel free to let me know. For example, I thought it was odd to have to
    include the "cInt" for every form field, but it didn't work until I did.


    Newbie Supreme
     
    Newbie, Jul 7, 2003
    #1
    1. Advertising

  2. Newbie

    MDW Guest

    Try using session variables, like thus:

    On your second page -

    Session("CoName") = Request.Form("company_name")

    On your third page:

    <input type="text" name="cmpany_name_to_db" value="<%
    =Session("CoName") %>">

    >-----Original Message-----
    >OK, this may be impossible since I'm using 3rd party

    shopping cart ASP
    >software, but I've been able to finagle a lot of other

    stuff I thought
    >wouldn't work, so here we go:
    >
    >I'm using a form in which users enter numbers to be

    calculated into a square
    >footage cost. Upon submitting, the results page uses ASP

    to give the total
    >and the chance to add the new totalled item to the cart

    or try a new
    >calculation. Part of the cart's software has

    a "returnURL" variable you can
    >enter to tell what page will open up once the item is in

    the cart. I'm
    >trying to open the new page with one form field that is

    already filled in
    >with one variable that was set in the "add to cart"

    page. So far, I am
    >unable to do it.
    >
    >Is it possible to fill in a form field with a variable

    passed from one page
    >without using previous form fields or submit buttons?

    The reason I want the
    >form field to use a previous variable's value is that the

    field, upon
    >submission of the 3rd page's form, will populate an

    Access field.
    >
    >Here's the progression:
    >
    >- 1st page is a form where user enters company name and

    several numbers in
    >fields for square footage calculation. Submit button

    goes to...
    >- 2nd page: No form fields, just the totals and company

    name, etc. A
    >hyperlink here uses the cart's syntax to add the order to

    the shopping cart.
    >Part of the hyperlink includes the URL to open upon

    adding the item to the
    >cart.
    >- 3rd page: Another form where the user enters much more

    detailed info
    >about the order into form fields, all of which populate

    an Access db. I
    >would like to carry the CompanyName from the 2nd page to

    this one, and
    >automatically enter that value in the CompanyName form

    field.
    >
    >Here's the ASP code of the 2nd page:
    >
    ><%
    >Dim UpchargeA
    >Dim Company
    >
    >
    >ON ERROR RESUME NEXT
    >response.write request("CompanyName")%>: Your

    preliminary cost, including
    >upcharges, is:<br><br>
    >
    >
    >
    ><%
    >ON ERROR RESUME NEXT
    >response.write (((cInt(request("A1")) + cInt(request

    ("A2")) +
    >cInt(request("B")) + cInt(request("B2")))/cInt(request

    ("C")))*1.645)
    >+cInt(request("Upcharge"))
    >%>br><br>
    >Would you like to continue?
    ><p><a href="1stPage.asp">NO, return to liner quote

    system</a> <br><br>
    >
    ><a href="ShoppingCartCodeThatAddsToCart.asp?

    Productname=Whatever&price=
    ><%
    >ON ERROR RESUME NEXT
    >response.write (((cInt(request("A1")) + cInt(request

    ("A2")) +
    >cInt(request("B")) + cInt(request("B2")))/cInt(request

    ("C")))*1.645) +
    >cInt(request("Upcharge"))
    >%>
    >&quantity=1&returnurl=../3rdPage.asp">Yes, I would like

    to purchase this
    >liner</a>
    >
    >
    >It's the "3rdPage.asp" that is the cart's info for what

    new page to open
    >upon placing the item in the cart. I tried using the
    >....asp?CompanyName=Whatever", and the corresponding ASP

    on the 3rd page to
    >populate the "CompanyName" field, but it doesn't work.
    >
    >I am using FrontPage and little tidbits of asp that I'm

    gradually learning.
    >If it helps, the 3rd Page is a FrontPage Form Results

    page that populates
    >the db with all the given info upon clicking "Submit"

    (made by using the
    >Send To wizard thingy).
    >
    >Thanks for any help, it is much appreciated.
    >
    >PS: If the above code seems very cumbersome and can be

    streamlined, please
    >feel free to let me know. For example, I thought it was

    odd to have to
    >include the "cInt" for every form field, but it didn't

    work until I did.
    >
    >
    >Newbie Supreme
    >
    >
    >
    >.
    >
     
    MDW, Jul 7, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. POL8985
    Replies:
    1
    Views:
    591
    Kevin Spencer
    Jan 31, 2005
  2. arkgroup

    passing # in hyperlink field in gridview

    arkgroup, Jan 4, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    742
    arkgroup
    Jan 4, 2007
  3. NotGiven
    Replies:
    3
    Views:
    389
    Michael D. Kersey
    May 13, 2004
  4. GavMc
    Replies:
    4
    Views:
    385
    Evertjan.
    Sep 22, 2005
  5. NotGiven
    Replies:
    3
    Views:
    333
    Michael D. Kersey
    May 13, 2004
Loading...

Share This Page