I've got an issue with a header redirect that is confusing me. I haven't been able to find any similar problems that have help me solve it and the PHP man page on headers isn't helping me either.
<?php
if(isset($_POST['add_cat'])) {
$cat_obj->add_category($_POST['cat_title']);
header("Location: admin/category.php");
}
?>
This code is in a file called add_category.php which is in the same directory as the category.php file I want it to redirect to.
without the 'header..' line it works perfectly; but with the 'header..' line I get the following warning -
but there's no other place sending headers (that I can see) and to my inexperienced eye it seems like it's cyclical logic as it's saying the same line I want to send the redirect is the one that already sent it. Would someone mind giving me an ELI5 breakdown of why this isn't working properly and maybe a route to solving the problem, please? TIA