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.
Do you have the php code in app.php? If you have then you have not enabled mod\_php in Apache. I would recommend you to use wampserver (on windows) since that takes care of the basic apache/php configuration.

<http://www.wampserver.com/en/> 

EDIT: You can not just execute your php code without having a webserver. Opening HTML files in your browser is client side and php is server side.