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 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 Share on other sites More sharing options...
unemployment Posted February 17, 2011 Author Share Posted February 17, 2011 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 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 Share on other sites More sharing options...
unemployment Posted February 17, 2011 Author Share Posted February 17, 2011 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 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 Share on other sites More sharing options...
petroz Posted February 17, 2011 Share Posted February 17, 2011 Did any of this help? 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 Share on other sites More sharing options...
unemployment Posted February 17, 2011 Author Share Posted February 17, 2011 Did any of this help? 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 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 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.