外部php echo / print_r不向浏览器输出值

时间:2016-11-01 00:39:51

标签: php html forms post echo

这是代码保存在名为form.php的文件中     

<html>

<head>
    <title>Form</title>
</head>

<body>
    <form acion = "insert.php" method = "POST">
        UserName:<br> <input type = "text" name = "uname"/><br>
        Password:<br><input type = "password" name = "pswd"/><br>
        First Name:<br><input type = "text" name = "fname"/><br>
        Last Name:<br><input type = "text" name = "lname"/><br>
        <input type = "submit" value = "submit"/>
    </form>
</body>

</html>

此代码保存在同一文件夹(xampp / htdocs / aform)中名为insert.php的文件中

<?php
    echo "hello world";

    $uname = $_POST['uname'];

    print_r($_POST['uname']);

    $pass = $_POST['pswd'];
    $first = $_POST['fname'];
    $last = $_POST['lname'];

    print_r($_POST['uname']);
    echo $uname;

?>

单击提交按钮后,echo或print_r语句都不会向浏览器返回任何内容。

1 个答案:

答案 0 :(得分:0)

纠正这个问题(你缺少't'):

<form acion = "insert.php" method = "POST">

要:

<form action = "insert.php" method = "POST">
相关问题