Hi again guys, as part of my plan to offer a fully-fledged front-end student management system for my site, I'm trying to add a page where there is a list of all students and a checkbox next to each name. Whichever student has a checkbox next to their name gets deleted upon form submit.
Have tried the following but think I have lost my way!
<?php
if($input->post->submit) {
$students = $pages->get("template=students")->children();
foreach ($input->post->$student->name as $s) {
if (isset($s)) {
$deletable = $users->get($student->name);
$deletable->delete();
echo $deletable->name . " has been deleted!";
}
}
}
?>
<form action="" method="post">
<ul>
<?php foreach ($students as $student) { ?>
<li>
<?php echo $student->name; ?>
<input type="checkbox" name="<?php echo $student->name; ?>">
</li>
<?php } ?>
<input type="submit" value="Delete selected users" name="submit">
</ul>
</form>
Am I missing something simple here?
For those who are stuck doing similar things, I have managed to get the adding and modifying students front-end bit pretty sorted I think so more than happy to lend a hand!