I want to write a code that will view all the records within a table and assign a checkbox for each record.. the check box will be used for deleting the records just like in emails. can anyone help me on this?
try this example:
suppose you want following to be done:
here  is check box
then do following to get above:
1.suppose you have two variable $rec1 and $rec2 which contains data to be printed along with check box,
2.prepare a $rspString like following:
just assign a checkbox with a different name to each one with id value as the checkbox value. then use the foreach() statement to loop through the post results and regex the key to make sure it belongs to that set of input elements. after that take the value from the foreach statement and use it in a query to delete the record.
i know that sounds complicated and you probably don't understand it. if you need some example code let me know.
here is the code. i am not for sure if it will work properly with your setup because i don't know the rest of the code, but i have used a similar system in many of my admin centers i have created and it works nicely.
what i did with the $tr_data is store the html into a variable instead of echoing like you had. this makes it so i can use the header() function to redirect, sorry its a force of habit. i can change if you want. the foreach() block starts off by reading the post data sent from the form where you checked the checkboxes. "foreach" of the array values it checks if the key (name element in html) is valid. if it is then it deletes the employee otherwise it skips it.
$tr_data = ''; is where i declared and clear the variable.
on the foreach() stuff:
foreach($_POST as $key => $value) pretty much means that it reads each element in the array and seperates the 'key' into the $key variable and seperates the 'value' into the $value variable. $_POST is an array of values submitted from a form. the foreach statement just runs through the $_POST array.