此代码将不断打印三个

I'm a beginner and I just can't seem to get this to work. Any suggestions? Please help.

Here's a portion of the code, saved under a php file

 <?php
     /**check if enter is pressed*/
     if (isset($_POST['enter'])) {
        /**set vars to results*/
        $uname = isset($_POST['uname']);
        $upass = isset($_POST['upass']);
        $key = isset($_POST['key']);
        /**print results*/
        echo $uname;
        echo $upass;
        echo $key;
    }

  ?>
<html>
    <head>
        <title>Chat gate</title>
    </head>
    <body align="center" valign="middle">
        <form action="index.php" method="POST">
            <tt>Enter your username</tt>
            <input type = "text" name ="uname" required>
            <tt>Enter your password:</tt>
            <input type = "password" name = "upass" required>
            <tt>Confirm key:</tt>
            <input type = "text" name = "key" required>
            <input type = "submit" name = "enter">
        </form>
    </body>
</html>

You need to remove the isset in the variable assignment so change to this.

$uname = $_POST['uname'];
$upass = $_POST['upass'];
$key   = $_POST['key'];

isset returns 1 (true) if the variable you pass it is set, and 0 (false) if it is not set, meaning as all your varibles are set, 111 is been printed. If you want to check if they are set before you print them, you need an extra if statement.

Maybe something like this to check they are all set before printing them.

if (isset($_POST['uname'], $_POST['upass'], $_POST['key'])){
    echo $uname;
    echo $upass;
    echo $key;
}