Php中表单的GET与Post

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

method="get" get为显性显示,你所发的参数,会在地址栏里显示 ,并且字符有大小限制,限制为100个字符 

获取参数方式为

welcom <?php echo $_GET["name"];?>.<br/>
You are <?php echo $_GET["age"];?>.<br/> Years Old!

  

例如地址栏里显示:

http://localhost/PHP100/welcome.php?name=zhaoying&age=33

 

 

method="post"   参数不会显示在地址栏中,并且字符没有大小限制

<form action="welcome.php" method="POST">
name:<input type="text" name="name" />
age:<input type="text" name="age" />
<input type="submit"/>
</form>

 

welcom <?php echo $_POST["name"];?>.<br/>
You are <?php echo $_POST["age"];?>.<br/> Years Old!

  

 

 

posted @ 2016-03-23 11:39  长马脸  阅读(160)  评论(0)    收藏  举报