php $GET与$POST获取表单内容

       一个form表单内容如下:   

<html> 
<body>
<form action="server.php" method="get">
name: <input type="text" name="name">
age: <input type="text" name="age">
submit: <input type="submit" name="submit">
</form>
</body>
</html>

       将form表单提交给server.php,server.php内容如下:

<html>
<body>
Welcome <?php echo $_GET["name"] . " "; ?>
You are <?php echo $_GET["age"] . " "; ?> years old!
</body>
</html>

       如果用POST方法,将form表单里的method改为post,将server.php里的$GET改为$POST即可。

版权声明

本站文章、图片、视频等(除转载外),均采用知识共享署名 4.0 国际许可协议(CC BY-NC-SA 4.0),转载请注明出处、非商业性使用、并且以相同协议共享。

© 空空博客,本文链接:https://www.yeetrack.com/?p=117