I have a form where users sign up/remove themselves from a database. Problem is they can sign up but they cannot remove themselves. When they fill out the form to delete themselves it says everything should work (no errors are given) but when you check the database they're still up there. Can someone help me figure this out?

You can see the script at http://sulfericacid.perlmonk.org/neopets/add.pl.

use strict; use warnings; use POSIX; use CGI qw/:standard/; require SDBM_File; my %list; my $list = "list.dbm"; #change to location of database tie %list, 'SDBM_File', $list, O_CREAT | O_RDWR, 0644; if ( !tied %list ) { print "database unsuccessful $!.\n"; } print header, start_html('Neopets I/S nickname list:'); print start_form(), table( Tr( td("Your username: "), td( textfield( -name => 'username', -size => 40 ) ) ), Tr( td("What you wish to be called: "), td( textfield( -name => 'askname', -size => 40 ) ) ), Tr( td( radio_group( -name => 'update', -values => [ 'add', 'rem' ] ) ), ), Tr( td(), td(submit) ), ), end_form(), hr(); print qq(<a href="list.pl">view the current list!</a><br><br><br>); if(param()){ my $username = param('username'); my $askname = param('askname'); my $update = param('update'); if($username){ if($username){ if($update eq "add"){ if(exists $list{$username}){ print "Username already exists in database.\n"; } else{ $list{$username} = $askname; print "Username was added to our system!<p>\n"; } } elsif($update eq "rem"){ if(exists $list{$username}){ del $list{$username}; print "Account information was removed from the sy +stem.\n"; } else{ print "Oops, it doesn't appear that username is in + our database.\n"; } } } else{ print "For this to work please add your username.\n"; } }else{ print "Unless your name is null, please go back and fill it in +.\n"; } } print end_html();


"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid

In reply to deleting item from database by sulfericacid

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.