Hello, I have two files, one file is named messages.php the other file is named processing.php. The messages.php file displays html that has a table, in this table are rows and in each row it contains a checkbox and a message topic (the topic is displayed as a url). The rows, checkboxes, and message topics are all created dynamically at run-time, and the message topic comes from a mysql database. The mysql database contains the following fields: mID (is id and is Primary Key), mTopic, mMessage, mDeleted.
Now back to the messages.php file, when a user clicks any of the checkboxes and then clicks the Delete button at the bottom of the form, the form is suppose to submit these values to the processing.php file. The processing.php file will then update the corresponding mDeleted field in the mysql database for that particular message topic. Below is a copy of my messages.php file and my processing.php file so you can see it. But I need help to make it do what I have described above, please help?
messages.php File
<table>
<form name="messages" method="post" action="processing.php">
<?php
$result = mysql_query("SELECT * FROM messages WHERE mDeleted != '0' ORDER BY mID DESC ")
or die(mysql_error());
while($row = mysql_fetch_array( $result )) {
$mID = $row['mID'];
$mTopic = $row['mTopic'];
?>
<tr>
<td>
<input type="checkbox" name="delCB[]" id="delCB[]" value="1"/><a href="readmessages.php?mID=<?php echo $mID; ?>"><?php echo $mTopic; ?></a>
</td>
</tr>
<?php
}
?>
<input type="submit" name="submit" id="submit" value="Delete" />
</form>
</table>
processing.php File
<?php
for($i=0;$i<count($_POST["delCB"]);$i++){
$result = mysql_query("UPDATE messages SET mDeleted='1' ") or die(mysql_error());
}
header('Location: http://www.mysite.com/messages.php');
?>