I have a page where users post form. It's in `php`.

If a user is already logged in, the form is not shown.
If a user is not logged in, the form is shown.

Now, when a user first visits the site, the form is shown. Then he fills the form and `submits` it as `POST`. On successful login, he is re-directed to the same page. 

The problem is, after been re-directed to the same page, the form is still visible. Though, if I refresh it, the form disappears.

How can I change/modify to achieve what I want.

I don't know if giving my code will be helpful or not. Though, according to SO I'm attaching my basic code:

```
    if(!isset($_SESSION['id'])){
    //show form
    <form action="" method="post">
        <br><button class="lfloat" type="submit" id="submit" value="register0" name="submit">Register</button><br><br>
    </form>
    <?php if(isset($_POST['submit'])&&$_POST['submit']=='register0'){
        //do all the insertion of data into database here only.
        ....
        ....
        echo "Success!!";
    }
}
if(isset($_SESSION['id'])){
    //don't show form

}

```