am having a problem, but there 2 problems, i cant delete single user and when i try to delete a single user it brings user deleted to all users below
the problem it cant fetch each user id on deletion process
and well it fetch it when page loads but not delete each user
my $db_id = $cgi->param("dbid"); my $select_names = $dbh->prepare("select id, name from names"); $select_names->execute(); my $names = $select_names->fetchall_arrayref(); if (param('delete') eq 'delete') { my $delete = $dbh->prepare("delete from names where id =?"); $delete->execute($db_id); $delete->finish(); $success = "user deleted"; } $dbh->commit; $dbh->disconnect; print "Content-type: text/html\n\n"; my $temp_html = <<START_HTML; <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <form method="post"> <p> </p> [% FOREACH name IN list %] <p>Name: [% name.1 %] </p> <input type="hidden" name="dbid" value="[% name.0%]"> <button type="submit" name="delete" value="delete">delete User</bu +tton> <p>$success</p> [% END %] </form> </body> </html> START_HTML $html->process (\$temp_html, { list => $names}) or die $html->error;
In reply to delete single user by bigup401
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |