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>&nbsp;</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

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.