I have a simple coding problem. I try to create a page with a textbox and a share button.

When the user clicks the share button the text in the textbox get inserted as string into the database table named "posts".

I use the following code.

```
<?php
    if(isset($_POST['share']))
    {
            $status = $_POST['status'];
            $res = mysql_query("insert into `posts`(postid,username,post,pointscollected) values('','$username','$status','')");
            if($res)
                echo "<script type='text/javascript'>alert('Posted successfully')</script>";
            else
                echo "<script type='text/javascript'>alert('some error')</script>";
    }
    else
    {
        ?>
            <form action="<?php $_SERVER['PHP_SELF']?>" method="post">
            Status : <input type = "text" name ="status">
            <input type = "submit" name ="share">
            </form>
        <?php
    }

```

This solution works fine but there is a **problem when the user refreshes the page**. The browser will show a message window asking for resend the information, which will submit the post to the table again. Then the **same entry is in the table twice**.

I want the **user to stay on the same page** after submitting. But a page refresh should not show the message window or send the information again.

Thanks in advance!