Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['submit']))
- {
- if(isset($_POST['selection']) && is_array($_POST['selection']))
- {
- if(count((array) $_POST['selection']) == 1)
- {
- $query_build = '= ' . $_POST['selection'][0];
- }
- else
- {
- $query_build = 'IN (' . implode(', ', $_POST['selection']) . ')';
- }
- //$query = mysql_query("DELETE FROM table WHERE id $query_build");
- echo "DELETE FROM table WHERE id $query_build";
- }
- else
- {
- echo 'You must select 1';
- }
- }
- ?>
- <form action="" method="post">
- <input type="checkbox" name="selection[]" value="1" /> 1
- <input type="checkbox" name="selection[]" value="2" /> 2
- <input type="checkbox" name="selection[]" value="3" /> 3
- <input type="submit" name="submit" value="delete" />
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement