SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: checkbox array

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Location
    Lincolnton
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    checkbox array

    Hi all, I am working on a web based file management type thing for my site and I would like to be able to delete multiple files at once but I don't know how to loop through the checkboxs to see which ones were checked. I think you have to setup the input filelds like this
    <input type=checkbox name=files[] value='filename'> Filename

    but I donn't now how to code the while loop to move through the checkboxs to see which ones have been checked and then grab the value of that checkbox so I can delete the file.

    If anyone has any experiece with this I would appreciate the help.

    Thanks,
    Link-Spy.com

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well only checked checkboxes will be sent when the form is submitted, so it should be as easy as:

    PHP Code:
    foreach($files as $key => $val) {
    unlink($val);

    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •