SysAdm has asked for the wisdom of the Perl Monks concerning the following question:

I have a script that reads a text file...
The user can display different data from the file using a search function... now all I need to do is have a way for the user to click on an link next to each result that will enable them to make a "print list" from the list of data.

Another words... I need to make a temporary file that stores the users choices from the displayed list and when finished, can print the list... Also need to have this temporary file deleted once the user prints it...

Any help in this matter would be greatly appreciated...

Thanks in advance...

___________SysAdm

Edit 2001-03-09 by tye to update title and add formatting

Replies are listed 'Best First'.
Re: Generating a
by archon (Monk) on Mar 09, 2001 at 12:28 UTC
    This is a very general question and would probably require someone to pretty much write your whole program for you, but you have left out too many details. It would help if you showed us what you have so far and any specific problem areas.

    Incidentally, it sounds like you are going about this in the wrong way. What you probably want is a database that holds all your information. Then you can just query the database given the user supplied data. That would save you a lot of trouble as far as creating and deleting temporary files.

    HTH HAND

      O.k... here is the code that opens the file and declares the variables...
      sub a { open(DATA, "<$config{'basepath'}/data.out") || die "Can't open file: $ +!"; @lines = <DATA>; close (DATA); $listings = 0; foreach $temp (@lines){ ($num,$date,$desc) = split(/\|/,$temp); if ($num =~ /^123$/) { print "$desc\n"; $listings = 1;} } if ($listings eq "0") {print "There are no listings for "123" at this +time.\n";} }
      The user has a clickable link to see if any '123' listings are in the file..
      <A HREF=$ENV{'SCRIPT_NAME'}?action=a>Click for '123' listings</a><br>
      Example of return if '123' exists:

      Results for '123':

      Apple - Click HERE to add to list
      Pear  - Click HERE to add to list     
      Orange - Click HERE to add to list
      Grapefruit - Click HERE to add to list
      Banana - Click HERE to add to list
      

      I would like to be able to have a link at the end of each return value that would "build" a list of the ones the user wants..

      So if they clicked next to Orange and Grapefruit and they were done searching, they would click a link that would let them print a list that would just have Orange and Grapefruit in it...

      Hope this helps...

      _______SysAdm

      Edit 2001-03-08 by tye

        Sounds like you want a radio group. Check the CGI module for information on how to build radio_groups with it. (You _are_ using CGI.pm, aren't you?).