dongzi0850 2014-05-22 23:16
浏览 333
已采纳

我应该在HTML表单中使用method =“POST”或“post”吗? [重复]

This question already has an answer here:

I want to handle data with PHP by post method and I want to know if both ways ("post" and "POST") are recommended.

Should I use method="POST" or method="post" in HTML form?

Thanks.

</div>
  • 写回答

2条回答 默认 最新

  • drjv5597 2014-05-22 23:30
    关注

    Better to stick with lowercase so you aren't tempted to type all your tags and attributes as if you're shouting at the browser. Also, you should be coding your modern HTML to the XHTML standard, not to 90s HTML.

    This is the 90s way: <FORM METHOD="POST" ACTION="">

    Today its advised to use lowercase for tags and attributes, although for the values of the attributes do whatever you want: <form method="post" action="">, <form method="POST" action="">

    Why? Because of XHTML. For a document to be valid XHTML the spec says:

    4.2. Element and attribute names must be in lower case

    XHTML documents must use lower case for all HTML element and attribute names. This difference is necessary because XML is case-sensitive e.g. <li> and <LI> are different tags.

    Of course for ids and names like in <input id='x' name='product_id' /> the capitalization matters as <input id='X' name='Product_Id' /> the id is different to the DOM and the name sent to the server is now different.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探