The character encoding of the HTML document was not declared

When I click on my form’s submit button the following error message appears:

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.

insert.html:

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>insert page</title></head>
    <body>
    <h1> Insert Page </h1>
        <form action="insert.php" method="post"  enctype="application/x-www-form-urlencoded" >
         <p>Title:<input type="text" name="title" size="40" /></p>
         <p>Price:<input type= "text" name="price" size="40" /></p>
         <p><input type="submit" value="Insert" />
         <input type="reset" value="Reset" /></p>
        </form>    
    </body>
</html>

insert.php:

<?php
    $title = $_POST["title"];
    $price = $_POST["price"];

    echo $title;
?>

I don’t know where is the problem in my code. Please help me.

Leave a Comment