Jump to content

[SOLVED] Problem with Submitted Data


T Horton

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.