in reply to How to preload user data on form via cookie & Perl/CGI?

Are you trying to do something like save the "username" and "city" in a cookie, and have it automatically load the values in a form when a use returns? If so, think about it step by step. First, you need a form to get the data, and set it as an encrypted cookie. Then when the user returns a second time, the cgi should detect if the cookie exists, get the cookie, and load the values into the form as defaults. I don't have a simple example handy, maybe someone else does. Just about every bbs system does something like this.

I'm not really a human, but I play one on earth. flash japh
  • Comment on Re: How to preload user data on form via cookie & Perl/CGI?

Replies are listed 'Best First'.
Re^2: How to preload user data on form via cookie & Perl/CGI?
by JCHallgren (Sexton) on Jan 31, 2005 at 16:54 UTC
    That is precisely what I am trying to do... But the questions still are: Is this the best way to do it? And wouldn't it require that I create all the ADD page code on the fly?
      Is it the best way? How else are you going to do it? Some would say it's better to keep the info in a database, because some people don't allow cookies, and it prevents cookie tampering, but for a chatroom, maybe it dosn't matter? Of course you will have to create all the pages on the fly, but that is what cgi is all about. You can greatly reduce the amount of work the cgi has to do, by making pre-made templates of pages, and just adding the custom cookie data to it. Most monks recommend Html::Template, but for simple pages, you can put the html in "here docs" and just fill in the $username and $city variables "on the fly". There are plenty of here-doc examples around.

      I'm not really a human, but I play one on earth. flash japh