'Reload does not change POST state

I have a problem where I want to reload the page on submit. I did this with the simple script function shown below. However, the echo'd "hello" does not disappear when I reload. Is there a reload function that changes the state of my submit post, and the "hello" is no longer appearing.

<!DOCTYPE html>
<html lang="en">
<body>
<form method="post">
    <button class="btn-login" type="submit" name="submit">Sign in</button>
</form>

<?php
if (isset($_POST['submit'])) {
    echo "hello";
    echo "<script>window.location.reload(true)<script>";
}


Solution 1:[1]

If you want to redirect to a new page (or even the same page) but without POST values, then use

window.location.replace(url)

https://developer.mozilla.org/en-US/docs/Web/API/Location/replace

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kadet