Good Evening Monks!

I'm writing a simple To-Do application in a way to learn Perl. The database table consists of three fields: time, status, and content.

I want to be able to see my items and to update a particular item at the same time. I am having trouble with the update portion of the script.

You can view the code in my scratchpad.

The script initially calls for subroutine show_item() which shows the item information. This subroutine shows two different methods of updating the item.

The first: submit (-name => "choice", -value => "Update") - applies the update to all the items, doesn't post to the database table and when you refresh the page the original information prior to the update appears. The update never occurred.

The second: " [", a ({-href => update_url}, "Update"), "]", doesn't apply the update and removes any information associated with that item except for the time. The update never occurred.

Here are the areas of the script that has update coded:

elsif ($choice eq "update") sub update_item sub show_item
Any guidance or advice you can give will be greatly appreciated.

Thanks.


In reply to Problem with an update subroutine by hbradshaw

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.