zoukankan      html  css  js  c++  java
  • form表单提交

    表单:数据的提交

      action:数据提交的地址 ,默认是当前页面
      method:数据提交方式,默认是get方式
        1.get
          把数据名称和数据值用=连接,如果有多个的话,那么他会把多个数据组合用&连接,然后把数据放到url?后面传入到指定页面
        2.post
          enctype:提交的数据格式 ,默认application/x-www-form-urlencoded

    1.post提交方式

    HTML

    <form action="post.php" method="post">
    	<input type="text" name="username"/>
    	<input type="text" name="age" />
    	<input type="submit" value="提交"/>
    </form>
    

    PHP

    <?php
    header('content-type:text/html;charset="utf-8"');
    error_reporting(0);
    
    $username=$_POST['username'];
    $age=$_POST['age'];
    
    echo "你的名字:{$username},年龄:{$age}";
    ?>
    

    2.get提交方式

    HTML

    <form action="get.php">
    	<input type="text" name="username"/>
    	<input type="text" name="age" />
    	<input type="submit" value="提交"/>
    </form>
    

    PHP

    <?php
    header('content-type:text/html;charset="utf-8"');
    error_reporting(0);
    
    $username=$_GET['username'];
    $age=$_GET['age'];
    
    echo "你的名字:{$username},年龄:{$age}";
    ?>
    

      

  • 相关阅读:
    php 中的 Output Control 函数
    web安全知识
    php写一个web五子棋
    实现一个web服务器, 支持php
    字节序
    TinyHTTPd源码分析
    linux 管道通信
    linux网络编程
    微信公众号开发-静默授权实现消息推送(微服务方式)
    初学 Nginx
  • 原文地址:https://www.cnblogs.com/yangxue72/p/8178386.html
Copyright © 2011-2022 走看看