Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Page 430- the cookie does not seem to work properly


Message #1 by "craig" <cn60@m...> on Wed, 16 Oct 2002 14:55:12
First i deleted all cookies on my machine. This is the partial output i am 
getting from the downloaded Exercise 2 on page 430, it is suppose to list 
by department, and then by price either ascending or descending. 
underneath is the code for the three pages. (hint: i think it may in the 
naming of the values in the form for ascending and descending, but i have 
them named the same in three other pages i created, and i still can not 
get the price to ascend or descend). thanks

Department Type Price to Buy Vendor Code Qty per box Date of Release 
 Juniors    hat        8           2      24                1/1/1998 
 Juniors    pants      21          3      6                12/1/2090 
 Juniors    shirt      14          3      12                3/3/1999 

here is the downloaded codefrom the wrox site, i checked the book errata 
but there was nothing there.

THE FORM:

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Chapter 11 Exercise 01 Set Preference Form</TITLE>
</HEAD>
<BODY>

<H1> Set Preferences Page</h1>
<p>Please select your preference 
in ordering the clothing items.</p>

<FORM action="2726-11-Cook-Exr02-SetPreferenceResponse.asp"
	method=get>
<INPUT TYPE="radio" NAME="Group" 
	VALUE="type" CHECKED> Group by Type of Item<br>
<INPUT TYPE="radio" NAME="Group" 
	VALUE="dept"> Group by Department<br>
<HR>
<INPUT TYPE="radio" NAME="PriceOrder" 
	VALUE="PriceAsc"> Within Groups, Order by ascending price<br>
<INPUT TYPE="radio" NAME="PriceOrder" 
	VALUE="PriceDes" CHECKED> Within Groups, Order by descending 
price<br>
<INPUT TYPE="Submit">
<INPUT TYPE="Reset">
</FORM>
</BODY>
</HTML>

THE RESPONSE:

<%@ Language=VBScript %>
<%Response.Buffer=true%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Chapter 11 Exercise 01 Set Preference Response</TITLE>
</HEAD>
<BODY>
<%
dim varGroup, varPriceOrder
varGroup = Request.querystring("Group")
varPriceOrder = Request.querystring("PriceOrder")

Response.Cookies("Clothier")("Group") = varGroup
Response.Cookies("Clothier")("PriceOrder") = varPriceOrder
Response.Cookies("Clothier").expires = date + 365
%>
<P>A notation has been made for you<br> 
that you prefer your items grouped by<br>
<%
Select Case varGroup
Case "type"
	Response.Write " the <i>type</i> of the item, "
Case "dept"
	Response.Write " the <i>department</i> of the item, "
End Select

Response.Write "<br>and within the group ordered by price from "
Select Case varPriceOrder
Case "Asc"
	Response.Write "<i>lowest to highest</i>."
Case "Des"
	Response.Write "<i>highest to lowest</i>."
End Select

%>
</P>

<P><A 
href="2726-11-Cook-Exr02-SetPreferenceHome.asp">
Click Here to go to Home page and use your newly-set preference.</A></P>
</BODY>
</HTML>

AND THE SET PREFERENCE HOME:

<%@ Language=VBScript %>
<%Response.Buffer=true%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>Chapter 11 Exercise 01 Set Preference Response</TITLE>
</HEAD>
<BODY>
<%
dim varGroup, varPriceOrder
varGroup = Request.querystring("Group")
varPriceOrder = Request.querystring("PriceOrder")

Response.Cookies("Clothier")("Group") = varGroup
Response.Cookies("Clothier")("PriceOrder") = varPriceOrder
Response.Cookies("Clothier").expires = date + 365
%>
<P>A notation has been made for you<br> 
that you prefer your items grouped by<br>
<%
Select Case varGroup
Case "type"
	Response.Write " the <i>type</i> of the item, "
Case "dept"
	Response.Write " the <i>department</i> of the item, "
End Select

Response.Write "<br>and within the group ordered by price from "
Select Case varPriceOrder
Case "Asc"
	Response.Write "<i>lowest to highest</i>."
Case "Des"
	Response.Write "<i>highest to lowest</i>."
End Select

%>
</P>

<P><A 
href="2726-11-Cook-Exr02-SetPreferenceHome.asp">
Click Here to go to Home page and use your newly-set preference.</A></P>
</BODY>
</HTML>



thanks again,
 craig

  Return to Index