I have this script which takes input from a user-specified file parses it into a set of arrays
and then prints up a table with the relevant information.

I now want to allow the user to add and or remove entries. I have the table print out and underneath
it a form into which the user will enter the info to add or remove.

Here's where the problem is, I have yet to figure out a good way to pass all the original info through
to the next instance of the script. I thought that I could read out all the array elements into the form
as hidden elements but I hope that there is an easier way to do it.

I also thought of reading the arrays into a text file but the file never got written into. I was using this code:

open ORGIDATA, ">orig" || die "Couldn't open! $!"; for (my $k = 0; $k < @classid; $k++) { if ($classid[$k] != $classid[$k-1]) { print ORIGDATA $classid[$k], " ", @{$class[$k]}, " ", $location +[$k], " ", $credits[$k], "<br>\\ n"; } } close ORGIDATA;
This code didn't touch the file at all (i.e. not only not written into but not clobbered either).
Any advice would be appreciated. I'm open to fixes of my code, reasons it didn't work, suggestions as to better ways of doing it, anything.
Thanks in advance for all help.

In reply to Keeping form information in CGI by deryni

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.