Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q1286 How do I display a survey if the user hasn't filled it out previously but not display it if the user has filled it out?

You are here: irt.org | FAQ | ASP | Q1286 [ previous next ]

The following was submitted by Marc W

Let's say you have a survey that you want first time users to fill out, but you don't want to annoy them by going to the survey every time they stop by. Cookies are a great way to take care of this problem w/out worrying about dealing with a database.

   'Request cookie as variable QQSurvey

   'Check to see if a cookie exists
   If Survey="" then

      'If no cookie exists, then we create it and set it so that it
      'doesn't expire for a while so they won't be sent to survey.asp
      'next time and then we redirect them to survey.asp this time
      Response.Cookies("QQsurvey").Expires=#January 01, 2010#
      Response.Redirect "Survey.asp"

   'If the cookie exists, then we redirect them to anypage.htm
   Response.Redirect "anypage.htm"
   End If

©2018 Martin Webb