Question

I have an html page with some very basic php in it. I have no idea why it is not working.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="author" content="Robin Van Campen">
    <meta name="description" content="Website showing XSS and HMAC" />
    <meta name="keywords" content="html, security "/>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link href="bootstrap.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="global.css" />
    <link href="Resources/Icons/favicon.ico" rel="icon" type="image/x-icon" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
    <title>Example 2</title>
</head>
<body>

<div class="container">
    <?php
        echo "<p>name</p>";
    ?>
</div>

</body>
</html>

The problem is when I load that page from clicking on a form button, I get this on the screen.

name
"; ?>

I can't see what I am doing wrong.  

Was it helpful?

Solution 2

You need to make the file .php instead of .html or configure your server to parse .html files.

OTHER TIPS

Is your file extension set to PHP? It looks like you are just adding php to a html file. You need to have PHP set as the file extension.

Your file has to be a PHP extension ie: myFile.php and also it has to be uploaded to your server before it will process since PHP pre-processor is serverside.

  1. Save your file with extension .php

  2. What server you are using? Apache Wamp Lamp Can process php pages on the go

If your using IIS for windows you require to install php extension

  1. If you have hosted your page somewhere check if your host provides php support
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top