Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I have a "small project" at school to create a small calculator with xhtml 1.0 strict and php. The result must be displayed on the same page.

When I put the code on http://validator.w3.org/check to be validated I get the fallow error:

Line 88, Column 9: end tag for "form" omitted, but OMITTAG NO was specified ✉ You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Thank you to anybody that's trying to solve my problem!

The code:

        <?php

require_once('base.php');
require_once('functions.php');

?>
<!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>Calculator</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>


    <form method="post" action="calculator.php">  

       <div id="number1">
            <p>1er numéro   : 
              <input type="text" name="field1" value="<?php if(isset($_POST['field1'])) { echo $_POST['field1']; } ?>" />
          </p>
        </div>
        <div id="number2">

            <p>2eme numéro: 
              <input type="text" name="field2" value="<?php if(isset($_POST['field2'])) { echo $_POST['field2']; } ?>" />
            </p>

        </div>

        <div id="operation">
        <p>opération :
        </p>
          <select name="field3"> 
            <option value="">Choisissez l'operateur:</option>

                <?php

                echo myselect();

                ?>

          </select>
        </div>



        <div id="submit">
            <input type="submit" name="submit" value="Calculé" />
        </div>



<div id="result">


<?php

        if(isset($_POST['submit'])) {
            echo mycalculator();
        }

    ?>
</div> 


share|improve this question
at the end of the code it's </body> </html> It didn't copy... Thank you in advance! – Cosmin Florin Craciun Sep 21 '12 at 18:12

closed as off topic by Jeff Vanzella, Corbin, Brian Reichle, James Khoury, Paul Sep 23 '12 at 6:28

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

You did not close the form tag correctly. So after the last input field you should close it, E.g.:

        <div id="submit">
          <input type="submit" name="submit" value="Calculé" />
        </div>
     </form>
share|improve this answer
Thank you very much for the fast response. – Cosmin Florin Craciun Sep 21 '12 at 21:46
I've already did that... but I receive even more errors after... All this is happening because i didn't know how to change <form name> in somenthing that xhtml strict is accepting. This was the original line: <form name="calculator" method="post" action="calculator.php"> I red on a forum that i can change <form name> with <form method=etc... But after Im closing the form, i receive more errors and the php script stops working. – Cosmin Florin Craciun Sep 21 '12 at 21:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.