John_Saunders
09-23-2002, 05:35 PM
I have a form on my website which uses cookies. I'm having big problems getting it to print a message for users who do not have cookies enabled. I've tried everything I can think of and I can only get it to post the form or the error message whether cookies are turned on or off.
Can somebody tell me what I need to change on this script so it will show the error if cookies are turned off and show the form if turned on?
header content
<%
count = Request.Cookies("count")
'### If the cookies has a NULL value write a value to it
if count = "" Then
Response.Cookies("count") = 0
Response.Cookies("count").Expires = Date + 1 '# wipes the cookie after a day
End If
'### Re-populate the count variable
count = Request.Cookies("count")
'### if it's still NULL then cookies must be off
if count = "" Then
%>
Your browser currently does not have cookies enabled. Please turn them on
<%
Else
count = CInt(count) + 1 '# use CInt as it will be a string from the cookie
Response.Cookies("count") = count
Response.Cookies("count").Expires = Date + 1
%>
<form>
form here
<%
If count < 5 Then
%>
<input type="submit" name="submit" value="submit"
<%
Else
%>
Please contact me for more info.
<%End If%>
</form>
<% End If %>
footer content
Any help would be greatly appreciated.
John
Can somebody tell me what I need to change on this script so it will show the error if cookies are turned off and show the form if turned on?
header content
<%
count = Request.Cookies("count")
'### If the cookies has a NULL value write a value to it
if count = "" Then
Response.Cookies("count") = 0
Response.Cookies("count").Expires = Date + 1 '# wipes the cookie after a day
End If
'### Re-populate the count variable
count = Request.Cookies("count")
'### if it's still NULL then cookies must be off
if count = "" Then
%>
Your browser currently does not have cookies enabled. Please turn them on
<%
Else
count = CInt(count) + 1 '# use CInt as it will be a string from the cookie
Response.Cookies("count") = count
Response.Cookies("count").Expires = Date + 1
%>
<form>
form here
<%
If count < 5 Then
%>
<input type="submit" name="submit" value="submit"
<%
Else
%>
Please contact me for more info.
<%End If%>
</form>
<% End If %>
footer content
Any help would be greatly appreciated.
John