简体   繁体   中英

PHP variable won't print

I have an html file with a form (with method=get) with inputs that takes a username with name user , and password pwd . The submit button then directs to a file called admin.php which looks like this:

admin.php:

<html>
<body>
<?php
    echo "user: $user";
?>
</body>
</html>

I can see the variables in the url being passed over, but when I load my admin.php it only prints user: and nothing else. I know this is probably a stupid question, but why is this so?

这将使其工作。

$user = $_GET['user'];

尝试像这样打印:

echo "user: " . $_GET['user'];
echo "user: " . $_POST['user'];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM