Simple question:
Using multiple checkboxes and assigning the value from mysql field with.
a loop showing all the data I need. I am created a form to delete
selected users from database. So I loop through all the ids and this is
the checkbox line. not exactly but close.
print "<input type=\"checkbox\" name=\"idnum\" value=\"$id\">"; in perl
Now I need to grab all the idnums and make an array in my action
perl-cgi script
my @idnums = param("idnum");
my blah = $query->param("blah");
etc..
My question is how do I make the simpliest loop to delete each idnum
from the database.
the way I have it now it only deletes the first selection.
foreach(@idnums){
$theid=$_;
delete from database name where id = $theid
# does other things sends email to user
}
There must be a better way? can I find the length of the array with
$length=@idnums;
$theid = 0;
if ($theid < $length) {
delete from database name where id = $idnums($theid)
#send email to user and other stuff
$theid = $theid +1
}
}else{
end
| Thread |
|---|
| • Simple Array Question | Douglas Brantz | 15 Jul |