php代码不起作用


php code not working?

我是php代码的新手。我的"learn.php"代码工作不正常。我想POST字段有一些问题。如果有任何帮助,我们将不胜感激,并建议为php提供一个好的调试器,因为我正在使用WebMatrix。我的Index.php文件:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Information Gethering</title>
    </head>
    <body>
     <h1>Welcome TO my Portal login</h1>   
        <form action="learn.php" method="post">
        First name: <br>
            <input type="text" name="firstname"><br> 
       Last name:<br> 
         <input type="text" name="lastname"><br> 
    Age: <br>
            <input type="text" name="age"><br> 
            <input type="submit" value="Submit">
        </form>
    </body>
</html> 

Learn.php文件:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Welcome Guest!</title>
    </head>
    <body>
        <?php
        echo" <p>You are logged In Gust!</p>";    
        $firstname=$_POST['firstname'];
        $lastname=$_POST['lastname'];
        $age=$_POST['age'];
        echo'<p> your details are as: </p>';
        echo $name. 'CEO' </br>;
        echo $last. 'WTF?' </br>;
        echo $age. 'Cool' </br>;
        ?>
    </body>
</html>

您忘记了变量

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Welcome Guest!</title>
    </head>
    <body>
        <?php
        echo "<p>You are logged In Gust!</p>";    
        $firstname  = $_POST['firstname'];
        $lastname   = $_POST['lastname'];
        $age        = $_POST['age'];
        echo '<p> your details are as: </p>';
        echo $firstname. 'CEO <br>';//changed $name + took </br> in comma + replaced </br> with <br>
        echo $lastname. 'WTF? <br>';//changed $last
        echo $age. 'Cool <br>';
        ?>
    </body>
</html>