Results 1 to 3 of 3

Thread: PhpMailer Redirect Error Message

  1. #1
    Join Date
    Dec 2008

    PhpMailer Redirect Error Message

    I am using the below code for a webform but getting the below error messages. Please help. Thanks.

    Error 1
    Warning: Cannot modify header information - headers already sent by (output started at class.phpmailer.php:1370) in processform.php on line 63
    Error 2 - With this error message the attachment is not required but can upload max 4 files.
    Could not access file: Array Could not access file: Array Could not access file: Array Could not access file: Array
    PHP Code:
    = array();
        if (
    $name           sanitize($_POST['name']);
    $email                 sanitize($_POST['email']);

            if (empty(
    $errors['name'] = "Please provide name.";
            if (!
    $errors['email'] = "Please provide a valid email address.";
    // If there are no errors let's process the payment
    if (count($errors) === 0)
    $mail = new PHPMailer();
    $mail->From     $email;

    $mail->Subject  "Test";
    $mail->Body     "some message here.";
    $mail->WordWrap 50;


    header("Location: thankyou.php"));
                }    }

    Last edited by phpnewbie08; 03-10-2013 at 02:43 AM.

  2. #2
    Join Date
    Aug 2004
    If you defined your HTML file inputs using the "[]" notation for its name, then instead of this...
    PHP Code:
    ...you'll want to do something like this...
    PHP Code:
    foreach($FILES['file']['tmp_name'] as $file_name) {
    $file_name)) {

    I'm guessing for now that the error message #2 is coming from that code, and is actually happening before error message #1, which is caused by the output of the #2 errors. If that's not the case, then it could be something else generating output, such as a BOM (byte order mark) before the opening <?php tag (if saving your PHP file as UTF-8, make sure it is without a BOM). If that's not it, then you might want to start the script with an ob_start() to buffer output.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Mar 2013
    Thanks nogdog, ob_start() helps the first problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center