标题位置不起作用但卡在页面中

so I have a button

<input type="button" value="add" onclick="document.location.href='add.php?myUcode=<?=$row['ucode'];?>'" />

to another page (let's call it Page1). in Page1, I want to add a value to $_SESSION['employees'] and then redirect it back to home.php. but when I click the button, it gets stuck in add.php. there is no echo or whitespace before I call the Header method. now I have no idea what is wrong with my code :

<?php
session_start();
if ($_POST['tambah_ucode']) {
if (isset($_SESSION['jum_petugas'])) {
    $_SESSION['jum_petugas'] = 1;
    $ctr = $_SESSION['jum_petugas'];
} else {
    $ctr = $_SESSION['jum_petugas'];
    $ctr++;
    $_SESSION['jum_petugas'] = $ctr;
}
$_SESSION['ucode_petugas'][$ctr] = $_POST['tambah_ucode'];
header('Location: localhost/hrm2.1/lembur_add.php');
}
?>

Try this,

header('Location: lembur_add.php');
exit;

OR

header('Location: http://localhost/hrm2.1/lembur_add.php');
exit;
header('location:localhost/hrm2.1/lembur_add.php')

without space

Try the following

header('Location:http://localhost/hrm2.1/lembur_add.php');

Instead of header(...), try

echo "<script type='text/javascript'> document.location = 'yourLocation'; </script>";