在PHP中使用isset()方法给出错误

时间:2014-03-31 04:21:17

标签: php

解析错误:语法错误,第41行的C:\ wamp \ www \ php \ webform.php中的文件意外结束。我一直试图解决此问题,但它一直在重新调整此错误。     我不知道为什么会出现这个

<html>
<head>
    <title></title>
</head>
<body>

<?php
$DisplayForm = TRUE;
$Number ="";

if(isset($_POST['Submit'])){
$Number = $_POST['Number'];
if (is_numeric($Number))
    $DisplayForm = FALSE;
else
{
    echo "<p>You need to enter a numeric value.</p>\n";
        $DisplayForm = TRUE;
}
}

if ($DisplayForm)
    {?>
    <form name="NumberForm" action="webform.php" method="post">
    <p>Enter a number : <input type="text" name="Number" value="<?php echo    $Number; ?>"/></p>
    <p><input type="reset" value="Clear Form"/>&nbsp;
    <input type="submit" name="Submit" value="Send Form"/></p>  
    </form>

    <?php}
    else {
            echo "<p>Thank you for entering a number</p>";
            echo "<p>Your number, $Number, squared is ". ($Number*$Number).".</p>\n ";
            echo "<p><a href=\"webform.php\">Try again?</a></p>\n";
        }
?>
</body>
</html>

1 个答案:

答案 0 :(得分:2)

只需在<?php}

之间留出空格