
randor
User
May 16, 2001, 7:08 AM
Post #2 of 4
(3073 views)
|
ok, your problem seems to be in your html, not your perl, when you create the checkboxes, you have created them all with 1 name "urls", the problem with that is that when the html sends the info, it will only send 1 value for each name, you have : urls = www.mysite.com urls = www.yoursite.com urls = www.thiersite.com so if they check more than one, it will ONLY send the last one checked, and throw out the rest. so what you need to do is to use different names for each value. here is an example: open (DATA, "base.txt"); @indata = <DATA>; close (DATA); $i = '0'; foreach $entries (@indata){ $i++; ($url, $title, $keywords, $email, $description) = split(/\::/, $entries); print "<input type=checkbox name=$i value=$url>$url \n"; } then when you want to check for deletion, use a count to do so: $urls = $INPUT'{urls'}; @userlist = split(/\,/, $urls); open (DBASE, "base.txt"); @alluser = <DBASE>; close (DBASE); open (WDBASE, ">base.txt"); foreach $lines (@userlist) { chomp ($lines); $url++; foreach $alllines (@alluser) { ($url, $title, $keywords, $email, $description) = split(/\::/, $alllines); unless ($lines eq $INPUT'{$url}) { print WDBASE $alllines; } } } close (WDBASE); i did not test this, but it should work, let me know if it doesnt, hope this helps.
|