Ave, I spent 3 hours trying to find or develop a solution for this problem... And believe it or not, within 3 minutes of sending the problem to the mailing list, I actually generated a solution!! Ray, you’re spot on with what’s actually happening, but this is what I did to resolve it... Here’s my code to generate the Dynamic Row with Checkboxes: <td width=15><span class=\"style11\"> <input type=checkbox name=thisID[] value=\"$myrow[ID]#imsafm/$showfilesuser/$myrow[filename]\"><input type=hidden name=login value=$login><INPUT TYPE=hidden name=showfilesuser value=$showfilesuser></td> I completely eliminated the Hidden field... Instead, added the value of both the Row ID & the Filename to the checkbox, with a seperator “#”. Here’s my code to delete the Row & Corresponding File: foreach($thisID AS $value) { $pieces = explode("#", $value); $sql = "DELETE FROM file WHERE ID='$pieces[0]'"; $result = mysql_query($sql) or die("Fatal Error: ".mysql_error()); $thefile = "$pieces[1]"; unlink($thefile); } As you can see, I basically explode the Array on the “#” seperator, and delete the Row & File. Is working like a charm!! On 6/1/06 4:07 PM, "Ray Hauge" <ray.hauge@xxxxxxxxxxxxxxxxxxxxxxx> wrote: > On Thursday 01 June 2006 12:58, Rahul S. Johari wrote: >> Ave, >> >> I¹m stuck on a problem here. >> I have a file manager kind of application and I¹m trying to add the >> functionality to delete multiple files. >> >> Basically, there¹s a bunch of rows generated dynamically. Each row has a >> checkbox for ³Delete² option, and a hidden field which contains the name of >> the File associated with the record. If a user checks a checkbox to delete >> certain rows, it should be able to delete those rows from mySQL as well as >> delete the files associated with that record. >> >> I created both the checkboxes & the hidden fields to be Arrays. I run a >> loop to delete all rows (based on ID¹s) where the checkbox was Checked. It >> does that part fine... The problem is linking the Filename array to the >> Checkbox Array. It deletes the first two files uploaded no matter what rows >> are checked. Basically, the Filename array is not associating with the >> Checkbox array. So if a person checks the 3rd and 5th checkbox... The 3rd >> & 5th row is deleted from mySQL, but the 1st and 2nd file is deleted, not >> the 3rd & 5th. >> >> Rahul S. Johari > > The problem is coming from how checkboxes submit their information to the > form. Only the checked checkboxes will actually send data. The unchecked > ones will not send anything. Hidden fields differ, in that they ALWAYS send > their data. This is probably causing a mis-match between the two arrays. > You could verify that by doing a var_dump on the arrays before you delete > anything. > > I would suggest that since you keep a record of the file in the database, > include the file location in that database record. Then before you delete > it, get the file name, delete the file, then delete the record. I think that > would save you a bunch of headaches. Rahul S. Johari Coordinator, Internet & Administration Informed Marketing Services Inc. 500 Federal Street, Suite 201 Troy NY 12180 Tel: (518) 687-6700 x154 Fax: (518) 687-6799 Email: rahul@xxxxxxxxxxxxxxxxxxxx http://www.informed-sources.com