php - Multiple actions for checkbox list -
i have list of multiple items having checkbox each row (like gmail list of emails).
user selects checkboxes , press action button perform action on selected items ( delete example). list of selected items sent php file background processing.
but solution performing multiple actions on selected checkboxes ( instance, in gmail, delete, mark spam, mark read/unread etc..).
here have:
use different "submit buttons" each actions. give same name different values. check backend
for example,
html
<form action="backend.php" method="post" > <input type="submit" name="action" value="delete" /> <input type="submit" name="action" value="move" /> <input type="submit" name="action" value="copy" /> <input type="checkbox" name="selection[]" value="value 1" > <input type="checkbox" name="selection[]" value="value 2" > <input type="checkbox" name="selection[]" value="value 3" > <input type="checkbox" name="selection[]" value="value 4" > <input type="checkbox" name="selection[]" value="value 5" > </form>
php
.................. .................. if($_post['action'] == "delete") ....... else if($_post['action'] == "move") ....... else if($_post['action'] == "copy") .......
Comments
Post a Comment