in reply to RE: Re: Form/File/Form Cookies
in thread Form/File/Form

Ok here is what I mean by having a form remember what was typed into it.

First a person fills out a form and it saves the information into a text database (IE. Configureration Form). Then they decide that they want to change one thing in the database file, so they go back to the form. At this point when they look at the form they see what they entered before already filled into the form so now all they have to do is to change that one field on the form. Then the form updates the database with the new settings.

Does that make since? I seen this done before but I have had no clue on how they done it. Also like I said before, I am very new at writing perl scripts and I am now just starting to learn. Basically I just gathered scripts that does somewhat what I need and then change it to what I need. Shoot I really dont even know how to write a perl script that saves to a file.. lol. But I am a fast learner, my first script that I ever built was a simple form to math script (like a shopping cart).

Thanks in advance...

Replies are listed 'Best First'.
RE: RE: RE: Re: Form/File/Form Cookies
by chromatic (Archbishop) on Apr 22, 2000 at 08:31 UTC
    Here's how the Everything Engine (which runs Perl Monks) handles that.

    Each user has a unique ID, stored in the database. Every node I create is marked with my user ID. When I visit a node, if the user ID matches mine, the engine displays a textfield with the node text in it. It also puts a submit button below.

    If I were to hit 'Submit', it would perform an update of the node in the database, simply replacing the text that was there before with the new text from the form field.

    You will need:

    • A database
    • Some way of authenticating users -- username, cookie, password, special ID
    • Some sort of association of user with text, in the database
    It's not too complicated, once you know the secret. I suggest looking at DBI.pm on CPAN, as the database and SQL parts are the only tricky things. CGI::Cookie on CPAN might also be useful.