hope there is a simple solution - i'm sure i'm just overlooking something obvious.
my objective is to move individuals from an organization into committees, and to promote committee members to chairman positions. the form ultimately has three scrolling list select menus, and the buttons move members from one to another. i'm currently working on moving members out of the committee list back to the organization list. haven't started on the chairman assignment until i get this direction worked out.
print div({-class=>'taskcolumnleft'}, h3("Chair(s) of<br>$name committee"), start_form({-action=>"/memberarea/cmt/members/edit/"}), hidden(-name=>'requestID',-value=>$requestID), $currentchairlist, submit(-name=>'submit',-value=>'Remove Chairs')); end_form; print div({-class=>'taskcolumncenter'}, h3("Current Members of<br>$name committee"), start_form({-action=>"/memberarea/cmt/members/edit/"}), hidden(-name=>'requestID',-value=>$requestID), scrolling_list(-name=>"currmembers", -value=>$mbrArray, -size=>20, + labels=>$mbrHash, -multiple=>"true"), p( [ submit(-name=>'submit',-value=>'<<= Assign as Committee Chair' +), submit(-name=>'submit',-value=>'Remove Members =>>') ]), end_form); } print div({-class=>'taskcolumnright'}, h3("Members<br>(not on this committee)"), start_form({-action=>"/memberarea/cmt/members/edit/"}), hidden(-name=>'requestID',-value=>$requestID), scrolling_list(-name=>"addmember", -value=>$nocIDArray, -size=>20, + labels=>$nocNameHash, -multiple=>"true"), p(submit(-name=>'submit',-value=>'<<= Add Members')), end_form);
and my processing functions are as follows;
sub add_members { foreach (@addmembers) { my $sql = "INSERT INTO cmt_members (CmtID, MemberID)"; $sql .= "VALUES ($requestID, $_)"; my $sth = $dbh->prepare($sql) || die "Error preparing: $DBI::errstr"; $sth->execute || die "Error executing: $DBI::errstr"; } } sub remove_members { print p("we're in the remove members function"); foreach (@currmembers) { print p($_); my $sql = "DELETE FROM cmt_members WHERE MemberID = $_ and Cmt +ID = $requestID"; print p($sql); $sth = $dbh->prepare($sql) || die "Error preparing: $DBI::errstr"; $sth->execute || die "Error executing: $DBI::errstr"; $requestID = $requestID; } }
the "add_members" function works great - the "remove_members" doesn't
i have tested what post-data is being passed, and the @addmembers array works, but the @currmembers doesn't. i put in the line "print p("we're in the remove members function"), to test if it's being called, and it is, but @currmembers is empty.
In reply to CGI: multiple forms on page by jck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |