cookies的问题
我是初学者,下面是自己写的代码表单部分:
<html>
<body>
<Form name="TestCookies" method="post" action="cookies程序.asp">
<p>请输入您的姓名:<input type="text" name="txtName" size="6" maxlength="15">
<p>请输入您的性别:<input type="Radio" name="rdoSex" value="male">男
<input type="Radio" name="rdoSex" value="female">女
<p>请选择cookies的时间:<input type="Radio" name="rdoCT" value="7">一周
<input type="Radio" name="rdoCT" value="30">一个月
<input type="Radio" name="rdoCT" value="365">一年
<p><input type="submit" name="btnSubmit" value="提交">
<input type="reset" name="btnReset" value="取消">
</Form>
</body>
</html>
程序部分:
<%Response.Buffer=True%>
<%
Dim txtName,rdoSex,rdoCT,VarNum
VarNum=Request.Cookies("intVisit")
txtName=Request.Cookies("txtName")
rdoSex=Request.Cookies("rdoSex")
rdoCT=Request.Cookies("rdoCT")
IF VarNum<>"" AND txtName<>"" AND rdoSex<>"" AND rdoCT<>"" Then
VarNum=cInt(VarNum)+1
txtName=Request.Form("txtName")
rdoSex=Request.Form("rdoSex")
rdoCT=Request.Form("rdoCT")
Response.Cookies("intVisit")=VarNum
Response.Cookies("txtName")=txtName
Response.Cookies("rdoSex")=rdoSex
Response.Cookies("intVisit").Expires=DateAdd("d",cInt(rdoCT),date())
Response.Cookies("rdoCT").Expires=DateAdd("d",cInt(rdoCT),date())
Response.Cookies("txtName").Expires=DateAdd("d",cInt(rdoCT),date())
Response.Cookies("rdoSex").Expires=DateAdd("d",cInt(rdoCT),date())
Select Case rdoSex
Case "male"
Response.Write txtName & "先生您好,你是第" & VarNum & "次光临本站"
Case "female"
Response.Write txtName & "小姐您好,你是第" & VarNum & "次光临本站"
End Select
Else
Response.Redirect "cookies.asp"
End If
%>
当用户第一次访问程序部分时,要求用户注册,然后把注册信息保存到cookies里,第二次访问是提示“XX先生/小姐您好,这是您第N次访问本站”
我是自学ASP的,程序部分弄了半天还没写出来,不要笑我笨,因为才学了两个月。大家能不能帮忙改改程序部分,谢谢了