You are here: Re: [PHP] Multiple file delete « PHP « IT news, forums, messages
Re: [PHP] Multiple file delete

Posted by John Nichel on 10/01/29 11:10

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@kegworks.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация