How can I change a web page title for everyone on that site and **not** to be changed with refreshing, using javascript or PHP?

I've tried **HTML DOM title** but it gets back to its first title after refreshing.

I've tried giving **variable in PHP** and changing it by after a button pressed but the title didn't change!
These were my codes:

```
<?php
    $title = "Chat";
?>
<html>
    <head>
        <title><?php echo $title ?></title>
    </head>

    <body>
    <div id="chat_messages"></div>
                <form enctype="multipart/form-data" method="post">
                        <input onClick="dokme()" class="button2" type="submit" name="send" value="Send">
                </form>
    </div>
            <?php
             if(isset($_POST['send'])){
                $title = "new message";
             }
            ?>
    </body>
</html> 

```

Any idea what should I do?