Questions about passing variable through Javascript from one html page to another page

Hello everyone, my name is Magnus. I am stuck on a question by developing the website. I have found a useful program on the internet, but I did not know how to change the codes into my situation. My codes are shown here:(‘_____’ are the parts I do not know how to finish)

Html code:

    <input type='input' name='nick' id='nick'>
    <a href='test.php'>button</a>
    <script src=""></script>
PHP code (Although Javascript and PHP codes should not be put into the same program, it worked):
    var test=_____________;

Would you mind to answer me how to fill in those blanks? Thanks for your help!

Links I have referenced:

The method used to pass the variable through javascript from one HTML page to another page:

The link proves that the PHP code works:

3 posts were merged into an existing topic: Questions about Javascript, PHP and MySQL