Array operation

Discussion in 'Perl Misc' started by Kuna, Jan 16, 2007.

  1. Kuna

    Kuna Guest

    Hi All,

    I am having problem in implementing array operation in my task these
    are:

    In my form I have some multiple entry fields which are showing in a row
    and below that I have an Add button which will add the rows again in
    the form which I have done by incrementing the value but for deleting
    the rows I have a check box and when selecting the check box and
    hitting delete button it suppose to delete the rows which I had
    selected and I am just taking an array and keeping the values in the
    array to not shoe the selected row after delete button. But the problem
    is that delete is working as it need to work when I am going to save
    the form data then it was having the deleted values in the array and
    showing the fields again. So what will I do for solve this problem
    please suggest me. Here is the code I have used for the array storing
    purpose:

    <code>
    our @rows = qw(); # this is the array I have declared globally for the
    entire form.

    ====
    if ( $var eq 'delete' || $var eq 'add' ) {
    push (@rows,"$checkid");
    }
    $number_of_rows = @rows; # it is checking for the check box click and
    push those rows to the array.
    ====

    $is_download=0;
    for (my $u=0; $u < $number_of_rows; $u++)
    {
    if ($rows[$u] eq $i)
    {
    $is_download=1;
    last;
    }
    }
    if ( $i eq $checkid || $is_download eq 1 ) {
    }
    else {

    #The form goes here

    }
    </code>
    Kuna, Jan 16, 2007
    #1
    1. Advertising

  2. On Jan 16, 12:08 pm, "Kuna" <> wrote:

    > I am having problem


    [ snip: suspected stealth-CGI question with confusing description and
    very little, (and quite possibly, not relevant) code ]

    Please produce a _minimal_ but _complete_ (strict, warning-free) script
    that you have actually run and found to illustrtate your question. This
    and much other helpful advice can be found in the posting guidelines.

    Random-shot-in-the-dark: You are forgetting CGI.pm is sticky be
    default.
    Brian McCauley, Jan 16, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hal Vaughan
    Replies:
    8
    Views:
    426
    M.J. Dance
    Sep 11, 2006
  2. ZHIQUAN
    Replies:
    12
    Views:
    1,462
    ZHIQUAN
    Jan 27, 2007
  3. david ullua
    Replies:
    13
    Views:
    640
  4. raan
    Replies:
    2
    Views:
    435
  5. Buzz Lightyear
    Replies:
    10
    Views:
    1,101
    Alexander Bartolich
    Aug 12, 2009
Loading...

Share This Page