unemployment Posted February 17, 2011 Share Posted February 17, 2011 I made a private messaging system. There is a select all checkbox, but how do I create a function that says delete all of the selected messages? I'm just looking for some logic on this. Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/ Share on other sites More sharing options...
petroz Posted February 17, 2011 Share Posted February 17, 2011 Can you show some of your code? I might be able to point you in the right direction... Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/#findComment-1175386 Share on other sites More sharing options...
unemployment Posted February 17, 2011 Author Share Posted February 17, 2011 Quote Can you show some of your code? I might be able to point you in the right direction... This is the code that does that individual delete <td class="center"><a href="messaging.php?action=delete&cid=<?php echo $conversation['id']; ?>"><img src="assets/img/delete.png" alt="Delete" title="Delete" /> Does this help? Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/#findComment-1175387 Share on other sites More sharing options...
petroz Posted February 17, 2011 Share Posted February 17, 2011 I dont see any check boxes... Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/#findComment-1175388 Share on other sites More sharing options...
unemployment Posted February 17, 2011 Author Share Posted February 17, 2011 Quote I dont see any check boxes... <td><label><input type="checkbox" name="delete_select" onclick="selectone();" id="box<?php echo $conversation['id']; ?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/#findComment-1175389 Share on other sites More sharing options...
petroz Posted February 17, 2011 Share Posted February 17, 2011 I find it easier to work with an array for check boxes. Look at the example below. <?php if($_SERVER['REQUEST_METHOD'] == "POST") { $box = $_POST['myCheckBox']; foreach($box as $checked) { //delete($checked); print_r($checked); echo "<hr>"; } } else { //do something get ?> <form target="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="checkbox" name="myCheckBox[]" value="1"> <input type="checkbox" name="myCheckBox[]" value="2"> <input type="checkbox" name="myCheckBox[]" value="3"> <input type="submit"> </form> <? } Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/#findComment-1175400 Share on other sites More sharing options...
petroz Posted February 17, 2011 Share Posted February 17, 2011 Did any of this help? Quote I find it easier to work with an array for check boxes. Look at the example below. <?php if($_SERVER['REQUEST_METHOD'] == "POST") { $box = $_POST['myCheckBox']; foreach($box as $checked) { //delete($checked); print_r($checked); echo "<hr>"; } } else { //do something get ?> <form target="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="checkbox" name="myCheckBox[]" value="1"> <input type="checkbox" name="myCheckBox[]" value="2"> <input type="checkbox" name="myCheckBox[]" value="3"> <input type="submit"> </form> <? } Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/#findComment-1175404 Share on other sites More sharing options...
unemployment Posted February 17, 2011 Author Share Posted February 17, 2011 Quote Did any of this help? Quote I find it easier to work with an array for check boxes. Look at the example below. <?php if($_SERVER['REQUEST_METHOD'] == "POST") { $box = $_POST['myCheckBox']; foreach($box as $checked) { //delete($checked); print_r($checked); echo "<hr>"; } } else { //do something get ?> <form target="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="checkbox" name="myCheckBox[]" value="1"> <input type="checkbox" name="myCheckBox[]" value="2"> <input type="checkbox" name="myCheckBox[]" value="3"> <input type="submit"> </form> <? } You have actually confused me tremendously. Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/#findComment-1175444 Share on other sites More sharing options...
petroz Posted February 17, 2011 Share Posted February 17, 2011 Im sorry... kind of working in the dark with the amount of code your providing. If you can give me a bigger picture (More of your code....) I can problem write in a method there for you. Quote Link to comment https://forums.phpfreaks.com/topic/227938-delete-all-function/#findComment-1175445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.