Hello, I have a send page that have two sets of five fields each, with basically the same input names that are represented by the following variables arranged by row:

$recipname1   $recipemail1 #row1
$recipname2   $recipemail2 #row2
$recipname3   $recipemail3 #row3
$recipname4   $recipemail4 #row4
$recipname5   $recipemail5 #row5

I also allow users to set the number of fields for them to fill up. Like if they set $recipnumber to 2 (through a select menu), only two input fields ($recipname1 & 2 and $recipemail1 & 2) appear in the page. I have also gotten it to work so that, say $recipname1 had already been inputed with "Andrew" and $recipemail1 with "andrew@andrew.com", no matter how many times I set $recipnumber to different numbers from 1-5 the data still remains where they're supposed to be. However, my problem enters when say, there are currently 5 rows available, and $recipname5 and $recipemail5 are filled with values "Joseph" and "joseph@joseph.com" respectively (all other fields empty), when I set $recipnumber to 1 for example, of course only one row will appear, however, the 5th row values dissappear accordingly with the 5th row, which I am expecting anyway. I would like it to work so that the script can detect that the other fields are empty, and any row with readable values will fill in the higher fields, so that "Joseph" and "joseph@joseph.com" will appear in row 1 (since it is empty) instead of disappearing. If the 4th row was filled up, then its values will appear in the 1st row, but the fifth row values will be discarded. I hope you understand what I'm saying. I appreciate your help... Thanks!


In reply to Filling up empty values by drewboy

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.