It just reloads when inserting data

When I add data , it keeps redirecting me to index.php . This is my code

        $con = mysqli_connect('localhost', 'id4401278_db', '123456789', 'id4401278_grading');
        $code = $_POST['code'];
        $title = $_POST['title'];
        $q = "insert into subject(id, code, title) values('','$code','$title')";
        mysqli_query($con, $q);
        
        $act = "add new subject $code - $title";
        $this->logs($act);
        header('location:../subject.php?r=added');

Can you explain a bit more?