From PHP documentation :
header()
must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
And in your case, you are using echo
before header()
More Related Contents:
- Why I have to call ‘exit’ after redirection through header(‘Location..’) in PHP?
- PHP header(Location: …): Force URL change in address bar
- Cannot modify header information [duplicate]
- PHP generate file for download then redirect
- PHP page redirect [duplicate]
- How to cause a redirect to occur before php script finishes?
- PHP store hours, closed dates [closed]
- How can I find where I will be redirected using cURL in PHP?
- Nginx serves .php files as downloads, instead of executing them
- How to fix “Headers already sent” error in PHP
- Why won’t my PHP app send a 404 error?
- Header only retrieval in php via curl
- How to create an error 404 page using PHP?
- Redirecting to previous page after login? PHP
- Symfony2 – Force file download
- Creating a PHP header/footer
- php, file download
- Back to previous page with header( “Location: ” ); in PHP
- Laravel 5.4 redirection to custom url after login
- Redirect with PHP after ajax call
- What is the format for e-mail headers that display a name rather than the e-mail?
- How to redirect back to form with input – Laravel 5
- how to redirect domain according to country IP address
- How to redirect to the same page in PHP
- Show Curl POST Request Headers? Is there a way to do this?
- PHP get pdf file from base64 encoded data string
- WWW to non-WWW Redirect with PHP
- Redirecting WordPress’s Login/Register page to a custom login/registration page
- Download of .zip file runs a corrupted file php
- PHP Streaming MP3