Header may not contain more than a single header, new line detected error
Okay, this one was a toughie but I figured it out. Here is my method:
- So the clue lies in the error itself. It was pointing me from my processing php. But it was only because the data being asked in the header (requires a reference ID) is wrong.
- The problem was in the reference ID (after much debugging). It was taking the wrong value from the wrong variable. This was in the php form page not the php processing page.
So here is the solution:
$s->bindvalue(':refid', $refid);
Rest of the code:
<input type="hidden" name="ref_id" value="<?php echo $rid; ?>" >
The variable $rid
is not the same as the variable $refid
.
Here is the fix:
<input type="hidden" name="ref_id" value="<?php echo $refid; ?>" >
This means that with this type of error, it might be worth looking at which part of the code it is trying to get the value from and start debugging from there.
Thanks for the help everyone!
Warning: Header may not contain more than a single header, new line detected
You should really use something like http_build_query()
; no need to manually URL encode and no messy string concatenation, eg
$query = array(
'day' => $date123,
'time' => $time_post,
// etc
);
header('Location: details_info_order.php?' . http_build_query($query));
exit;
Php: Warning: Header may not contain more than a single header, new line detected in
What is unclear about the error?
You have a new line here:
\r\n
You are trying to set two headers. You need two header()
statements instead of one with a line break in the string.
header("Pragma: public");
header("Expires: 0");
die();
Related Topics
Laravel: I Can't Send More Then 2 Variables from Controller to a View
Get the Number of Pages in a PDF Document
Laravel Middleware with Multiple Roles
How to Generate a Custom Menu/Sub-Menu System Using Wp_Get_Nav_Menu_Items in Wordpress
How to See the Extensions Loaded by PHP
Setting Up Domainkeys/Dkim in a PHP-Based Smtp Client
Cascade Dropdown List Using Jquery/Php
How to Get the Function Name Inside a Function in PHP
Replacing Spaces with Underscores
Inspect Xml Created by PHP Soapclient Call Before/Without Sending the Request
Run PHPunit Tests in Certain Order
Facebook Sdk V4 for PHP Minimal Example