开发者

$_POST is empty, even without changes to php.ini?

开发者 https://www.devze.com 2023-04-05 23:07 出处:网络
I\'ve been following this tutorial to learn php so I have a html script: <html> <body> <form name=\"form\" method=\"post\" action=\"registernext.php\">

I've been following this tutorial to learn php so I have a html script:

<html>
    <body>
        <form name="form" method="post" action="registernext.php">
            <p>Username: <input type="text" name="username" size="15" maxlength="20" value="megaman"></p>
            <p><input type="submit" name="submit" value="register"></p>
        </form>
    </body>
</html>

and the php script:

<?php

echo file_get_contents('php://input');
$test = $_POST["username"];
echo " testname = (".$_POST["username"].")";

?>

But what I get when I run it is:

username=megaman testname = ()
开发者_开发百科

My problem is that the name (megaman) get's sent to POST but doesn't show up in the php script.

Also, I haven't made any changes to the php.ini as oppose to some others that had problems when they did so.

I don't know if this helps but I'm running this via xampp (fresh download).

Help would be deeply appreciated, as searching for solutions haven't been successful.


try replacing all the PHP code with

<?php
var_dump($_POST);
?>

submit the form. if anything comes up then nothing is wrong with PHP.

0

精彩评论

暂无评论...
验证码 换一张
取 消