1. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    London, UK
    Rep Power
    I am writing some forum software, and for the administration part of it, I want to be able to delete articles (plural). Currently, I can only do this with radio buttons, and an SQL query like:

    delete from db where (id = $id);

    Now the new challenge is to be able to have checkboxes instead of radio buttons so lots of articles can be deleted at once. Any ideas on how this would be done?

  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Rep Power
    What if you use something like
    <input type=checkbox name=ID[]>

    I don't know if it works, because I only made something like this in listboxes

    Good luck
  4. #3
  5. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Rep Power
    First make your check box as array variable like following:
    Article1 <input type="checkbox" name="id[]" value="1">
    Article2 <input type="checkbox" name="id[]" value="2">
    Article3 <input type="checkbox" name="id[]" value="3">

    In your script you can pass the selected values to Delete sql query like following:

    //loop through the selected item and delete that from the database..
    mysql_query("delete from db where (id = $id[$a])");

    SR -
    www.jobxyz.com-IT Career Portal

    "The fear of the LORD is the beginning of knowledge..."

Similar Threads

  1. deleting selected records using checkboxes
    By shyster2003 in forum PHP Development
    Replies: 13
    Last Post: January 15th, 2004, 02:01 AM
  2. Deleting multiple values
    By bohuslav in forum ASP Programming
    Replies: 1
    Last Post: December 30th, 2003, 04:06 AM
  3. Multiple checkboxes for accept terms form
    By Foxel in forum HTML Programming
    Replies: 5
    Last Post: October 8th, 2003, 04:42 PM
  4. Replies: 2
    Last Post: October 8th, 2003, 01:26 AM
  5. Multiple checkboxes with same name??
    By cjgraphix in forum PHP Development
    Replies: 11
    Last Post: October 4th, 2003, 04:33 PM

IMN logo majestic logo threadwatch logo seochat tools logo