Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form to Cookie and Back Again 1

Status
Not open for further replies.

SkiCheif

Technical User
Sep 8, 2004
30
US
I am embarrassed...
I need to set a cookie based on these form elements:
Dynamic Combo Box
Regular Text Box
Hidden Text Box

When the cookies are set, I need to pass them on to the next page and then populate fields

Real Life Example of what I am trying to do:
match_entry.jpg

I have a wrestling stats page...

I want the user to select the following:
Form_Name: frmMatchEntry
Date of the Match (txtMatchDate [with a DateTimePicker])
Home Team (cboHomeTeam [with a Dynamic Combo Box])
Visiting Team (cboVisitingTeam [with aDynamic Combo Box also])

The User then will be directed to a page for each weigh class where they will select the home team wrestler and the visiting team wrestler.. then enter the results of the match.

The Problem:
When they press submit, the values need to pass on to the next page and subsequently on to 18 weigh classes total.
I have not been able to do this correctly.

The goal is to not make the user fill out the same info over and over again.

While I am at it, I want to display on the subsequent form pages the captured results for the match so far using the date and home team to get the records back out.


Background on my experience level:
I can do this easily in MS Access using VB (already have a functioning MSAccess Version). I have had classes in web development using PHP a year or two ago.

I am totally lost and although I have printed examples, I just can't get it to work. I am a purist when it comes to doing it by hand, but time and pressure have me doing this in DreamWeaver MX and using what functions they offer. If there is automatated ways of doing this there, it also escapes me.

Thanks for your help.
 
Since the values are part of a form then they will be passed to your next page. You can't set them to cookies until this next page because of the timing issues - ASP executes to buildthe page and send it to a user, setting the cookies in the first page will mean your trying to set the cookies before your user has even sen the page and had a chance to fill anything in.

So your second page (weight class page?) will have to be responsible for capturing that form data and setting it in the cookies. Something like:
Code:
<%
'assumed form names were txtMatchDate, selHomeTeam, selVisitingTeam
Response.Cookies("MatchDate") = Request.Form("MatchDate")
Response.Cookies("HomeTeam") = Request.Form("selHomeTeam")
Response.Cookies("VisitTeam") = Request.Form("selVisitingTeam")
%>
You would also show your form for weight class on this page as well as do a selection from your database based upon the form data you have collected so far. It would be safest on this second page to use the Request.Form data as the cookie data has not been sent to the client yet (it is sent as p[art of the headers for the HTML we are sending them to look at).

Your third page would grab any values filled out on the second page (weight class?) and add them to a cookie, and so on.


I have made a bunch of assumptions, but think I guessed correctly. I can't really give much more assistance from this point since I don't know the specifics of what your doing (ie, code). I'm not a Dreamweaver fan, so I don't knowhow much code would help out in this situation...

-T

barcode_1.gif
 
Thanks for the part about transferring the information to the second page. That was the key to what I was missing.

Still though, I am unable to get it to work..
You mention needing the code, so here is the code from each of the pages...

Setup Page with the form on it:
I tried to include the parts that you need to reach a conclusion
---------------------------------
<form action="75_weight.asp" method="post" name="EntryForm" id="EntryForm">
<input name="txtMatchDate" type="text" id="txtMatchDate" size="15" >
<select name="cboHomeTeam" id="select">
<select name="cboVisitingTeam" id="select3">
---------------------------------

Test Page (75_weight.asp)
---------------------------------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'form names were txtMatchDate, cboHomeTeam, cboVisitingTeam
Response.Cookies("MatchDate") = Request.Form("txtMatchDate")
Response.Cookies("HomeTeam") = Request.Form("cboHomeTeam")
Response.Cookies("VisitTeam") = Request.Form("cboVisitingTeam")
%>
<html>
<head>
<title>Test Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<%
dim mdate
mdate=Cstr(request.Form("txtMatchDate"))
response.Write("<p>Date: " & mdate & "!</p>")
%>
<p><%= Request.Form("txtMatchDate") %> </p>


<p>&nbsp;</p>
</body>
</html>

---------------------------------

The 'write' part of the code was from another example that I found. (It doesn't work either)

Ulitimately I would like to store all three values in a hidden text box and display them on the page so that the user can see them.

Thanks again for your help
 
I was able to get it to work.. thanks for your help.
 
Not a problem, sorry I didn't show up sooner to help you further, but I'm glad you found the second solution yourself,(I would have felt real guilty if you hadn't :) )

-T

barcode_1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top