Re: Multiple file delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ashley M. Kirchner wrote:

I have a page that displays the contents of a folder. Right now, each file has a little 'delete' button next to it that users can click on, however with many files it gets cumbersome. I need to be able to have them click on checkboxes and then hit one delete button which will then get rid of everything checked, but I don't know how to combine the form with PHP so that it takes the info from one into the other and delete what's needed. Any pointers would be very helpful. Thanks.


   -- A


Page 1 :

<form action="page2.php" method="post">
<input type="checkbox" name="delete[]" value="file1name" />....<br />
<input type="checkbox" name="delete[]" value="file2name" />....<br />
<input type="checkbox" name="delete[]" value="file3name" />....<br />
<!-- More HTML -->

Page 2 :

<?php

$size = sizeof ( $_POST['delete'] );
for ( $i = 0; $i < $size; $i++ ) {
    unlink ( $_POST['delete'][$i] );
}

?>

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@xxxxxxxxxxxx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux