treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Cookies to redirect to separate pages based on previous choice?

  • Is there a way to set a cookie to redirect to a page based on a previous selection?

    I am building a site which will start with a gateway page. Option 1 will lead them to site.com/option1 and Option 2 will lead them to site.com/option2. When they return, rather than being presented with the gateway page, can I have the site take them directly to site.com/option1 OR site.com/option2 based on their previous selection?

    If this is possible, can someone direct me to a tutorial, book, etc. to learn more how to do it? Thanks!

  • Okay, after more searching around, I've found that this is definitely possible. I haven't yet found any excellent tutorials or training material on getting started though. If anybody can point me in a great direction, I would appreciate it. Thanks!

  • If you use php you can use setcookie() and $_COOKIE ~ http://php.net/manual/en/features.cookies.php

  • @CrocoDillon Thanks for the help!