How To Delete Data By Checking The CheckBox - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How To Delete Data By Checking The CheckBox

RenzozukenRenzozuken Posts: 7Member
I need php coding to delete data

I want to make sure that the data deleted

#only data that is checked can be deleted
#data that are not checked cannot be deleted

so plz..........
help a programmer..


Comments

  • ManningManning Posts: 1,621Member
    : I need php coding to delete data
    :
    : I want to make sure that the data deleted
    :
    : #only data that is checked can be deleted
    : #data that are not checked cannot be deleted
    :
    : so plz..........
    : help a programmer..

    Give the checkboxes a common name. i.e. chkToBeDeleted. Give each checkbox a unique value. This value should identify the data in the database.

    When the form is submitted, $_POST['chkToBeDeleted'] will be a comma separated list of the values that were checked. You can use a simple SQL statement like this:

    SQL = "DELETE FROM mytable WHERE someid IN ({$_POST['chkToBeDeleted']})";

    Be sure to check that $_POST['chkToBeDeleted'] isn't blank first of course.
Sign In or Register to comment.