分享

关于form表单同时使用POST和GET传递参数说明

 天下无敌小勇 2016-02-16

1.之前就是用过,在form表单post提交时,action的url传递get参数,服务器端是能获取到的:

  1. <?php
  2. print_r($_GET);
  3. print_r($_POST);
  4. ?>
  5.  
  6. <form action="get_post.php?id=100" method="post">
  7. 姓名:<input type="text" name="name" /><br>
  8. 年龄:<input type="text" name="age" /><br>
  9. <input type="submit" value="提交" />
  10. </form>

2.但是如果你的form提交类型为get,url中传递的参数却是获取不到的:
  1. <?php
  2. /**
  3. *测试get和post提交
  4. *@link(http://www.)
  5. */
  6. print_r($_GET);
  7. print_r($_POST);
  8. ?>
  9.  
  10. <form action="get_post.php?id=100" method="get">
  11. 姓名:<input type="text" name="name" /><br>
  12. 年龄:<input type="text" name="age" /><br>
  13. <input type="submit" value="提交" />
  14. </form>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多