利用$_POST超级全局变量接收表单的数据,然后利用echo输出到页面。

下面是代码:

<!doctype html>
<html>
<head>
<title>利用超级全局变量$_POST接收表单</title>
<meta http-equiv="content-type" contnet="text/html" charset="utf-8"/>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"/>
Name:<input type="text" name="fname"/>
<input type="submit"/>
</form>
<?php
$name= $_POST['fname'];
echo $name;
?>
</body>
</html>

输出内容使用post方式提交数据,然后用$_POST['fname'];接收数据赋值到$name的全局变量中,

然后用echo输出$name;变量得到最终的结果,就是表单内的内容。...................

PHP利用超级全局变量$_POST来接收表单数据。

 

相关文章:

  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-12-30
猜你喜欢
  • 2022-12-23
  • 2021-04-27
  • 2021-11-20
  • 2021-12-22
  • 2022-12-23
相关资源
相似解决方案