Page 1 of 1
Unique Checkboxes!?
Posted: Sun Oct 30, 2005 9:43 pm
by Lang
OK, i'm making a forum, and i'd like to allow myself and moderators to delete multiple posts at a time, using checkboxes.
First I thought making the checkbox name the post subject, or the post ID. However that wou;dn't work 'cause then i'd need to know the ID ect ect and create a whole bunch of problems. Does anyone have an idea as to how I can do this?
Thanks in advance,
Posted: Sun Oct 30, 2005 10:28 pm
by feyd
their names can all be the same "delete[]" for instance, their values should be the post id's .. you already have the information, so it's not a stretch to use them..
Posted: Mon Oct 31, 2005 1:24 am
by Jenk
Hi, when I first stumbled across this same situation, I was always a little lost as to what people meant, so I'd thought I would add a lil' summin to help clarify
Code: Select all
<?php
if (isset($_POST['delete'])) {
foreach ($_POST['delete'] as $del) {
echo "$del<br />\n";
}
} else {
echo "<html>
<head>
<title>Testing..</title>
</head>
<body>
<form method=\"post\" action=\"\">
<input type=\"checkbox\" name=\"delete[]\" value=\"1\" /><br />
<input type=\"checkbox\" name=\"delete[]\" value=\"2\" /><br />
<input type=\"checkbox\" name=\"delete[]\" value=\"3\" /><br />
<input type=\"checkbox\" name=\"delete[]\" value=\"4\" /><br />
<input type=\"checkbox\" name=\"delete[]\" value=\"5\" /><br />
<input type=\"submit\" value=\"Submit\" />
</form>
</body>
</html>\n";
}
?>

Posted: Mon Oct 31, 2005 8:40 pm
by Lang
Thanks, guys.
Posted: Tue Nov 01, 2005 3:25 am
by AGISB
there is a nice tutorial in the tutorial section