Thanks. Yeah I already made changes similar to the ones you suggested-I have modified the design now and have multiple checkboxes and a single Update button.


The changes I made:

-I am now using CGI to retrieve "arrays of values"
-The form now has an update column with check boxes and a single update button for all rows.
-The value of update check box is set to TicketNo, which is my primary autonumber key so the value tells me which records need to be updated:
In the template:
...... <td> <input type="checkbox" name="Update" value="<!-- TMPL_VAR NAME=TicketN +o -->"></td> <td> <!-- TMPL_VAR NAME=TicketNo --></td> <td> <!-- TMPL_VAR NAME=Customer --></td> <td> <!-- TMPL_VAR NAME=UserName --></td> .... <td> <input type="text" value = "<!-- TMPL_VAR NAME=AssignTo -->" name= +"Detail" size="11"></td> .....

So the template will display records returned from the DB-the user can modify the fields displayed in a text box. (mulitple modifiable fields per record)
In the script:
..... @update = $query->param('Update'); @detail = $query->param('Detail'); ........... print "@update\n"; #Returns the ticket numbers for records that need t +o be updated print "@detail\n";#Returns details for ALL displayed records

Sample output is:
@update prints 40001 40003 40006 40007
@detail prints detail1 detail2 detail3 detail4 detail5 detail6 detail7

The question now:
Given two arrays of different lengths, I cannot use the same array index to access corresponding elements from the two arrays.

So how do I associate the right elements (40003 with detail3 and not detail 2)?

In reply to Re: Re: Logical question-to upate DB records by thisisperl
in thread Logical question-to upate DB records by thisisperl

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.