Header doesn't redirect after form submitted

Umm I don’t know how many files you have included in different files. Just understand the theory: Nothing must not output before some PHP functions like header(). So please put such code which use header() function on top before anything outputted to the browser.