Happy Holidays Everyone. I have a question re editing entries in a flat database. I'm still relatively new at PERL and am learning new things every day :) . I know how to add and remove entries from a flat database, but would like to know how to edit entries. Here's the removal section of the program that I'm playing with:
if ($command eq 'Remove') { &header('<title>Remove Unwanted Postings</title>'); print " $head $pageadmin $mid<center>\n"; print " <table border=0 width=100% cellspacing=0 cellpadding=1><tr>< +td bgcolor=#CCCCCC><b>&nbsp;Remove Outdated Entries</b></td></tr></ta +ble>\n"; print " Select entries you wish to remove an then click the <B>Proc +ess Information</B> button below.<br>\n"; print " </center>\n"; print " <form method=post action=\"$cgiUrl\">\n"; print " <input type=hidden name=action value=Remove>\n"; print " <input type=hidden name=USER value=\"$USER\">\n"; print " <input type=hidden name=PWD value=\"$PWD\">\n"; open(MESG,"$mesgFile") || &error(mesgFile); @lines = <MESG>; $size = @lines; close(MESG); @lines = sort(@lines); #This should sort the lines by alpha order #Number,IP,Name,URL,URL,Date,Comments $totalPage = int(($size-3)/10 + .95); $totalPage = 1 unless ($totalPage > 0); if ($page > $totalPage) { $page = 1; } $pageEntryMin = ($page-1)*10; $pageEntryMax = ($page*10)+1; $entry = -3; # Init to -3, since 3 starter lines print " <table width=\"100%\"><tr>\n"; print " <td width=\"25%\" align=center><hr noshade size=4></td>\n" +; $entryPlural = "Entr" . ($size-3 != 1 ? "ies" : "y"); $pagePlural = "Page" . ($totalPage != 1 ? "s" : ""); print " <td width=\"50%\" align=center>Info: ",$size-3," $entryPlu +ral on $totalPage $pagePlural &#183; Current Page: $page</td>\n"; print " <td width=\"25%\" align=center><hr noshade size=4></td>\n" +; print " </tr></table><p>\n"; print " <table width=\"100%\">\n"; foreach $line (@lines) { $entry++; next if ($line =~ m/<!--Name\/Pwd: (.*):(.*)-->/); next if ($line =~ m/<!--Restrict IP: (.*)-->/); next if ($line =~ m/<!--Add Here: (\d+)-->/); next if (($entry<=$pageEntryMin) || ($entry>=$pageEntryMax)); @entry = split(/\cR/, $line); $EntryNumber{$line} = $entry[0]; $IP{$line} = $entry[1]; $Event_Date{$line} = $entry[2]; $Seminar_Topic{$line} = $entry[3]; $Seminar_Location{$line} = $entry[4]; print " <tr>\n"; print " <td align=center valign=top><input type=checkbox name=r +emove$EntryNumber{$line} value=$EntryNumber{$line}><br></td>\n"; print " <td> <font size=-1>\n"; print " <b>Event #:</b> $EntryNumber{$line}<br>\n"; print " <b>Event Date:</b> $Event_Date{$line}<br>\n"; print " <b>Seminar Topic:</b> $Seminar_Topic{$line} <br>\n"; print " <b>Seminar Location:</b> $Seminar_Location{$line} <br> +\n"; print " </blockquote><p><br><br>\n"; print " </td>\n"; print " </tr>\n"; push(@usedValues,$EntryNumber{$line}); } print " </table>\n"; print " <input type=hidden name=usedValues value=\"@usedValues\">\n +"; print " <center>\n"; print " <table width=\"100%\"><tr>\n"; if (($totalPage<=1) || ($page==1)) { print " <td>Previous Page</td>\n"; } else { print " <td>Previous Page<input type=radio name=prevNext value= +",$page-1,"></td>\n"; } print " <td align=center>\n"; print " <input type=submit value=\"Process Information\">\n"; print " <input type=reset value=\"Clear Form\">\n"; print " </td>\n"; if (($totalPage<=1) || ($page==$totalPage)) { print " <td align=right>Next Page</td>\n"; } else { print " <td align=right><input type=radio name=prevNext value=" +,$page+1,">Next Page</td>\n"; } print " </tr></table>\n"; print " </center>\n"; print " </form> $footer\n"; print "</body>\n"; print "</html>\n"; exit; }
Thanks for any help! Happy New Year All!

In reply to Editing Entries In A Flat Database with cgi by koacamper

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.