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

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

P: n/a
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?Productna me=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

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
MDW
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 ASPsoftware, but I've been able to finagle a lot of other stuff I thoughtwouldn't work, so here we go:

I'm using a form in which users enter numbers to be calculated into a squarefootage cost. Upon submitting, the results page uses ASP to give the totaland the chance to add the new totalled item to the cart or try a newcalculation. Part of the cart's software has a "returnURL" variable you canenter to tell what page will open up once the item is in the cart. I'mtrying to open the new page with one form field that is already filled inwith one variable that was set in the "add to cart" page. So far, I amunable to do it.

Is it possible to fill in a form field with a variable passed from one pagewithout using previous form fields or submit buttons? The reason I want theform field to use a previous variable's value is that the field, uponsubmission 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 infields for square footage calculation. Submit button goes to...- 2nd page: No form fields, just the totals and company name, etc. Ahyperlink 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 thecart.
- 3rd page: Another form where the user enters much more detailed infoabout the order into form fields, all of which populate an Access db. Iwould like to carry the CompanyName from the 2nd page to this one, andautomatically 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, includingupcharges, 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 thisliner</a>
It's the "3rdPage.asp" that is the cart's info for what new page to openupon placing the item in the cart. I tried using the
....asp?CompanyName=Whatever", and the corresponding ASP on the 3rd page topopulate 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 populatesthe db with all the given info upon clicking "Submit" (made by using theSend To wizard thingy).

Thanks for any help, it is much appreciated.

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

Newbie Supreme

.

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.