T Horton Posted June 8, 2008 Share Posted June 8, 2008 Hi All Got a problem. I have this code: $id = $_POST['del']; foreach ($id as $key => $val) { $do = $pop3->delete_mail ($val); //$val is the ID of the message I want to delete, selected from the original form containing checkboxes if ($do == false) { echo $pop3->error; } Else { Header("Location : phishmail.php"); } } When I submit the form, it just stops on the page I have submitted a form to, and doesn't go on to the relevant page I have told it to, as you will see from the code. Even when I go back and refresh, it hasn't done what I had programmed it to do. Any ideas what I am doing wrong? Cheers Tom Quote Link to comment Share on other sites More sharing options...
Buddski Posted June 8, 2008 Share Posted June 8, 2008 You need to check for errors. Put error_reporting(E_ALL) at the top of the script and let us know of any errors Quote Link to comment Share on other sites More sharing options...
Loldongs Posted June 8, 2008 Share Posted June 8, 2008 $id isnt an array is it? Quote Link to comment Share on other sites More sharing options...
webent Posted June 8, 2008 Share Posted June 8, 2008 I agree with Loldongs, $id doesn't appear to be an array, but you're trying to treat it like one. Quote Link to comment Share on other sites More sharing options...
Buddski Posted June 8, 2008 Share Posted June 8, 2008 Im presuming that $_POST['del'] is an array of checkboxes or something As the $_POST['del'] doesnt give us any information as to its type. It could be anything.. Quote Link to comment Share on other sites More sharing options...
Loldongs Posted June 8, 2008 Share Posted June 8, 2008 do print_r($_POST); and comment out all the other code that will tell us Quote Link to comment Share on other sites More sharing options...
T Horton Posted June 8, 2008 Author Share Posted June 8, 2008 Hi All Thanks for your messages. Yes you are right. Basically what I am trying to do is this: - The user logs in to the website and this will then access email. - There are checkboxes in the first column to allow the user to delete a message. - They select the messages they want to delete and press the relevant button. I thought it would be best to put everything in an array so it can go through it all and delete the selected messages from the POP3 server. Done the "print_r" and it prints the following: Array ( [del] => Array ( [0] => 1 [1] => 2 ) ) It sends through the info OK, it is just the last bit I must be doing wrong. How would you go through each individual array and use the value as an ID to delete a message? Does this make sense? Cheers for all your help so far. Best Regards Tom Quote Link to comment Share on other sites More sharing options...
Buddski Posted June 8, 2008 Share Posted June 8, 2008 If you are returning a blank screen you should check for errors as i mentioned above.. One of those functions might be doing something your not expecting causing an error you might not be able to see. The foreach loop you have there is fine for what you are trying to achieve Quote Link to comment Share on other sites More sharing options...
T Horton Posted June 8, 2008 Author Share Posted June 8, 2008 I tried to put in the code you said (error_reporting(E_ALL)) and it is not returning anything. Any ideas? Quote Link to comment Share on other sites More sharing options...
T Horton Posted June 8, 2008 Author Share Posted June 8, 2008 Hi All I don't know what I did, but it is fixed ??? Works as I want it. Oh well, that is programming for you. Probably something simple I was doing wrong! Who knows. Thanks anyway everyone. Best Regards Tom 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.