Well for one, for some reason header() functions do not work on my web server, only on my localhost.
Is incorrect. You need to use a fully qualified URL:
Ive read online that if the browser receives any HTML tag before the header tag, it will not work, and I do indeed have HTML tags before my header tags on this page…
It’s not “HTML tags,” it’s “any output” (even blank lines, or a BOM if your text editor adds one). Do you understand how HTTP headers work?