Delete records using checkboxes? Ok my first question, How is your record stored? Indeed if you record is stored as a flat file seperated by delimeters
ex. IN foo.cvs
username,passord,date,browser type
nashirak,p3n,2002-09-12,netscape
.
.
.
etc.
Then you would have a list of records like this (all your users in this example), one would display the records:
<?php
$array = file("foo.cvs");
$i = 0;
while($i < sizeof($array)) {
display(array[i]);
$i++;
} ?>
or something like that, and add checkboxes with the delete option.
<input type=chechbox name="DEL_OPERATION" value="username">
where username is the username pulled out of the displayed file. Then one would simply submit the form and then
(I am doing this without the $GET[] or $POST[])
if(DEL_OPERATION != "") {
// WE need to delete a record
$array = file("foo.cvs");
$i = 0;
$fp = fopen("foo.cvs","w");
while ($i < sizeof($array)) {
$tmp = explode(",",$array[$i]);
if (tmp[0] != $DEL_OPERATION)
fputs($fp,$array[$i]);
$i++;
}// end while
fclose($fp)
or something like that, where you copy every line back to the file except the line you wanted to delete.
In a Database this is simpler: for instance MYSQL.
instead of looping etc you would simply
MYSQL_CONNECT($HOST,$USER, $PASS) or DIE
("Cannot Connect to Database");
@mysql_select_db("$DATABASE") or DIE ("Unable to select database");
$query = "DELETE FROM $TABLE WHERE UserName = '$DEL_OPERATION'";
$return = MYSQL_QUERY($query);
MYSQL_CLOSE();
or something like that....
I hope that answers your question.
(warning this code is probably full of syntax errors but gets the basics down)
--- Inserted LATER --------------------
I feel dumb now. I miss understood what you were asking :-D