Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-25 23:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found