我写了如下代码:
<?php
global $wpdb;
$table = $wpdb->prefix . 'submitted_form';
$randomFact = $wpdb->get_results( "SELECT * FROM " .$table);
$NumRows = count((array) $randomFact);
?>
<form name="delform" method="post" action="">
<table>
<?php for($i=0; $i<=$NumRows-1; $i++){ ?>
<tr>
<td><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php print $randomFact[$i]->id; ?>"> </td>
<td><?php print $randomFact[$i]->name; ?></td>
<td><?php print $randomFact[$i]->address; ?></td>
</tr>
<?php } ?>
<tr>
<td><input name="delete" type="submit" id="delete" value="Delete"></td>
</tr>
<?php if($delete): ?>
<?php for($i=0; $i<=$NumRows-1; $i++){ ?>
<?php $id = $checkbox[$i]; ?>
<?php $wpdb->query("DELETE FROM wp_submitted_form WHERE id =".$id); ?>
<?php } ?>
<?php endif; ?>
</table>
</form>
删除操作不起作用...请帮助我