PHP

Moderators: None (Apply to moderate this forum)
Number of threads: 1848
Number of posts: 5016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How To Delete Data By Checking The CheckBox Posted by Renzozuken on 20 Feb 2005 at 12:22 AM
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..


Report
Re: How To Delete Data By Checking The CheckBox Posted by Manning on 21 Feb 2005 at 6:48 PM
: 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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.