You will need two functions in your Perl program:

  1. Display a row to the user for editing
  2. Save a row to the new database after editing

So, I would introduce an URL parameter, say, action, which is either display (or empty) for the display action and save for the save action. Output something like the following HTML in the display action:

<input type="hidden" name="action" value="save">

You will likely also want to offer the user an option to reset their input:

<a href="?action=display;row=$current_row_identifier">Reset changes</a +>

You decide which part of your program to execute based on the action value:

my $action = param('action') || 'display'; if( $action eq 'save' ) { ... } elsif( $action eq 'display ) { ... } else { # Weird error };

Personally, I would look into Mojolicious or Dancer for doing the scaffolding of the web part of the application, but as they both are frameworks, you will have to learn some stuff not tightly related to creating the HTML and talking to the database. It is also quite feasible to do all you need with just Perl and print statements for the HTML generation.


In reply to Re^4: Perl: info from database into a form(HTML) by Corion
in thread Perl: info from database into a form(HTML) by alen129

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.