Hi everyone,
I'm trying to get a grip on using Cookies to set users preferences. As
always... I'm having a wee bit of hassle. If anyone could give me a hand
with this I'd realy appreciate it.

I'm going through this exercise and although I've copied the code exactly
it's not working.
First page is Preferences.asp where you select the page bg colour & which
topic you'd be interested in. On submit of the form the page should set a
cookie on the users machine with their prefs. then the user is automatically
taken to Content.asp which will list 5 links relevant to the topic they
picked and have the bg colour set to whatever they picked. Please help ..
:o(

TIA
jac.


Preferences.asp

<% Option Explicit %>

<%
If Request.Form("PreferencesSet")="True" Then
Response.Cookies("Preferences")("Colour")=Request.Form("Colour")
Response.Cookies("Preferences")("Topic")=Request.Form("Topic")
Repsonse.Cookies("Preferences").Expires="Dec 31, 2003"
Response.Write"<HTML><BODY>Preferences Set.<a href='Content.asp'>View
Page</a></BODY></HTML>"
Else
%>


<html>
<body>
<form method="POST" action="Preferences.asp">

<p> What topic are you interested in?</p>
<p>ASP <input type="radio" name="Topic" value="ASP" checked></p>
<p>JSP <input type="radio" name="Topic" value="JSP"></p>

<p> What colour scheme do you prefer?</p>
<p> Black on White <input type="radio" name="Colour" value="BW"></p>
<p> Yellow on Black <input type="radio" name="Colour" value="YB"
checked></p>

<p><input type="hidden" name="PreferencesSet value="True"></p>

<p><input type="submit" value="Record Preferences"></p>

</form>
</body>
</html>
<%End If%>

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

Content.asp

<% Option Explicit %>

<html>
<%
Dim ASP(5)
Dim JSP(5)

ASP(0)="ASP link 1"
ASP(1)="ASP_URL_1"
ASP(2)="ASP link 2"
ASP(3)="ASP_URL_2"
ASP(4)="ASP link 3"
ASP(5)="ASP_URL_3"

JSP(0)="JSP link 1"
JSP(1)="JSP_URL_1"
JSP(2)="JSP link 2"
JSP(3)="JSP_URL_2"
JSP(4)="JSP link 3"
JSP(5)="JSP_URL_3"

If Request.Cookies("Preferences")<>"" Then

If Request.Cookies("Preferences")("Colour")="BW" Then
Response.Write "<body bgcolor='white' text='black' link='black'
vlink='black'>"
End If

If Request.Cookies("Preferences")("Colour")="YB" Then
Response.Write "<body bgcolor='black' text='yellow' link='yellow'
vlink='yellow'>"
End If

'ASP link code
If Request.Cookies("Preferences")("Topic")="ASP" Then
Response.Write "<ul>"
i=0
Do While i<5
Response.Write"<li><a href='"& ASP(i+1)&"'>& ASP(i)&""</a></li>"
i=i+2
Loop
Response.Write "<ul>"
End If

'JSP link code
If Request.Cookies("Preferences")("Topic")="JSP" Then
Response.Write "<ul>"
i=0
Do While i<5
Response.Write"<li><a href='"& JSP(i+1)&"'>& JSP(i)&""</a></li>"
i=i+2
Loop
Response.Write "<ul>"
End If

Else
%>

<!--Next section is showing a link for the user to go back to
preferences.asp to set their prefs
 -->
<body>
<p><a href="Preferences.asp">Set Your Preferences.</a></p>
</body>

</html>
<% End If%>



____ • The WDVL Discussion List from WDVL.COM • ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: archive@jab.org
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to