got a really bugging issue for a while now and cant figure it out. basically the code below is part of a function and i checked and there is no output printed to the browser:
    case 'Failed': // if it fails...
        switch ( $unencrypted_values['Status'] ) {
            case 'NOTAUTHED':
            case 'REJECTED':
            case 'MALFORMED':
            case 'INVALID':
            case 'ABORT':
            case 'ERROR':
                $purchase_log = new WPSC_Purchase_Log( $unencrypted_values['VendorTxCode'], 'sessionid' );
                $purchase_log->set( array(
                    'processed'  => WPSC_Purchase_Log::INCOMPLETE_SALE,
                    'notes'      => 'SagePay Status: ' . $unencrypted_values['Status'],
                ) );
                $purchase_log->save();
                // if it fails redirect to the shopping cart page with the error
                // redirect to checkout page with an error
                $error_messages = wpsc_get_customer_meta( 'checkout_misc_error_messages' );
                if ( ! is_array( $error_messages ) )
                    $error_messages = array();
                $error_messages[] = '<strong style="color:red">' . $unencrypted_values['StatusDetail'] . ' </strong>';
                wpsc_update_customer_meta( 'checkout_misc_error_messages', $error_messages );
                $checkout_page_url = get_option( 'shopping_cart_url' );
                if ( $checkout_page_url ) {
                    header('Location: '.$checkout_page_url );
                  exit();
                }
                break;
        }
        break;
thats part of the function but when i run my script i get the error message:
Warning: Cannot modify header information - headers already sent by (output started at       /home/******/public_html/wp-content/themes/reallywildflowers/header.php:13) in      /home/reallyw/public_html/wp-content/plugins/myplugin/merchants/sagepay.php on line 598 - See more at: http://website.com/products-page/transaction-results/?crypt=NzsPDC0yayoLATltUScRGBA6HTw9NTcCJXMqezgmMVkJKh0LOSYzSy4rBVwFFREcAG8MAXgSPwY8IgpNGAZDLwEhChcqFS4oJioOBEZFUkhXd15Ab3ZiX31oPWkkIB0wAHIVT2B3YCl8d1sUQURXSUl7LzpgbBdTDwpGCkA1XUAlCVtObnBlFm8PBlYCGhFEUHxATX4AADgKGFkENjgpWSkOOjsQZxcPLTwOSgQmAAoRIxpFFQACKAELLx8nGxYNJyAKHQokJR4lOlZ0NiAmMSELSDsOcwQOOjsHTUo5JC0nBys8fgY/DT0PAl1KRENKIBwLGy0zMzg9Lx9MBEkqMkIMLy4OfBslHhg8ekM8LTUtfyc6GXBmPR15L3pRNwQLABsXCD18ACIaD011FgcRTSAmCREsMmtcfX5Z
line 598 is this one from the code:
header('Location: '.$checkout_page_url );
 
     
     
     
    