in reply to Form/File/Form

Ok I figured out one thing, now I have another question. How do I get a form on an HTML document to remember what was submitted before?

Replies are listed 'Best First'.
RE: Re: Form/File/Form
by ChuckularOne (Prior) on Apr 21, 2000 at 17:14 UTC
    If I understand the question;
    If the user fills in the field: username with the response "Chuck" you want to update the file with that information.
    You then want to display the screen again with that information still in place?
    if that's the case, the way I have done it in the (distant (about 2 years ago))past was to rebuild the html in the cgi script using data from the file to fill in the form defaults.
    Hope that helps.

    Your humble servant,
    -Chuck
RE: Re: Form/File/Form Cookies
by raflach (Pilgrim) on Apr 21, 2000 at 21:07 UTC
    Or use cookies. But the solution above is probably easier.
      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...

        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.