USharing
开放博客

php post 准确用法

<html>
<body>

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  Name: <input type="text" name="fname">
  <input type="submit">
</form>

<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // collect value of input field
    $name = $_POST['fname'];
    if (empty($name)) {
        echo "Name is empty";
    } else {
        echo $name;
    }
}
?>

</body>
</html>

https://www.w3schools.com/php/php_superglobals_post.asp

赞(0) 打赏
未经允许不得转载:USharing » php post 准确用法

觉得文章有用就打赏一下文章作者

微信扫一扫打赏