I have mysql database output using the dreamweaver mx repeat function. I have a check box by each item. The box is bound to the record id for the record. There is a delete button at the bottom of the form that takes the data to a processing page for deletion.
Here is the form code:
<form action="test.php" method="POST" name="delete" id="delete">
<table width="50%" border="0" align="center">
<tr bgcolor="#000000">
<td colspan="2"> <table border="0" width="50%" align="center">
<tr>
<td width="23%" align="center"> <?php if ($pageNum_rs_links_editlist > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rs_links_editlist=%d%s", $currentPage, 0, $queryString_rs_links_editlist); ?>"><img src="First.gif" border=0></a>
<?php } // Show if not first page ?> </td>
<td width="31%" align="center"> <?php if ($pageNum_rs_links_editlist > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rs_links_editlist=%d%s", $currentPage, max(0, $pageNum_rs_links_editlist - 1), $queryString_rs_links_editlist); ?>"><img src="Previous.gif" border=0></a>
<?php } // Show if not first page ?> </td>
<td width="23%" align="center"> <?php if ($pageNum_rs_links_editlist < $totalPages_rs_links_editlist) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rs_links_editlist=%d%s", $currentPage, min($totalPages_rs_links_editlist, $pageNum_rs_links_editlist + 1), $queryString_rs_links_editlist); ?>"><img src="Next.gif" border=0></a>
<?php } // Show if not last page ?> </td>
<td width="23%" align="center"> <?php if ($pageNum_rs_links_editlist < $totalPages_rs_links_editlist) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rs_links_editlist=%d%s", $currentPage, $totalPages_rs_links_editlist, $queryString_rs_links_editlist); ?>"><img src="Last.gif" border=0></a>
<?php } // Show if not last page ?> </td>
</tr>
</table>
</td>
</tr>
<tr bgcolor="#999999">
<td width="53%"><strong>Title</strong></td>
<td width="53%"><strong>Select</strong></td>
</tr>
<?php do { ?>
<tr>
<td><a href="links_editlinks.php?links_id=<?php echo $row_rs_links_editlist['links_id']; ?>"><?php echo $row_rs_links_editlist['links_name']; ?></a></td>
<td><input name="deletelinks[]" type="checkbox" id="deletelinks" value="<?php echo $row_rs_links_editlist['links_id']; ?>"></td>
</tr>
<?php } while ($row_rs_links_editlist = mysql_fetch_assoc($rs_links_editlist)); ?>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> <input type="submit" name="Submit2" value="Delete"></td>
<td> </td>
</tr>
</table>
</form>
Here is the page being taken to:
<?php require_once('Connections/conn_guard.php');
//$query = "DELETE FROM tbl_links WHERE links_id IN ('" . implode("','", $_POST['deletelinks']) . "')";
$array = $HTTP_POST_VARS['deletelinks[]'];
$sql = "delete FROM tbl_links WHERE links_id IN ($array) ";
?>
What am I missing. Thus far, nothing deletes. BTW, I am not an experienced coder. I have generated this code using Dreamweaver and by looking at examples of others work.