Question: I have following html file:

```
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Fancy Website</title>
</head>
<body>
    <div id="content_login">
        <form method="post" action="app.php">
            <table>
                <thead>Please Login for more fancy Content!</thead>
                <tr>
                    <td>Username</td>
                </tr>
                <tr>
                    <td><input type="text" name="username"></td>
                </tr>
                <tr>
                    <td><input type="submit" name="login" value="Login"></td>
                </tr>
            </table>
        </form>
    </div>
</body>
</html>

```

And this is my php script:

```
<?php
    if(isset($_POST['login'])) {
        echo "Hello " . $_GET["username"];
    }
?>

```

Yeah simply nothing, but I only wanted to test, if a script would work when the Login Button is pressed. Surprise: It's not. I open index.html in my browser and the html part works properly, but if I press the Login Button the browser shows me this:

```
<?php
    if(isset($_POST['login'])) {
        echo "Hello " . $_GET["username"];
    }
?>

```

I guess it's a syntax issue but I can't find it. Maybe you see it.
Thanks a lot!

Answer: 
My advice would be to use:

```
<?php
    if (isset($_POST['login']))
    {
        $username = $_POST['username'];

        if (!empty($username))
        {
            echo "hello $username";
        } else {
            echo "You must fill in the username!";
        }
    }
?>

```

To be honest, I would change index.html to index.php and place it into the top of that page so all errors etc are passed through one file.
you should change that $\_GET["username"] to $\_POST["username"] variable to work it correctly

```
<?php
    if(isset($_POST['login'])) {
        echo "Hello " . $_POST["username"];
    }
?>

```