value属性对HTML中的复选框意味着什么? [英] What does the value attribute mean for checkboxes in HTML?
本文介绍了value属性对HTML中的复选框意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设此复选框摘要:
<input type="checkbox" value="1">Is it worth?</input>
是否有任何理由在HTML中静态定义复选框的value
属性?是什么意思?
Is there any reason to statically define the value
attribute of checkboxes in HTML? What does it mean?
推荐答案
我希望我正确理解了您的问题.
I hope I understand your question right.
value属性定义了一个POST请求发送的值(即,您已将HTML表单提交给服务器). 现在,服务器将获得名称(如果已定义)和值.
The value attribute defines a value which is sent by a POST request (i.e. You have an HTML form submitted to a server). Now the server gets the name (if defined) and the value.
<form method="post" action="urlofserver">
<input type="checkbox" name="mycheckbox" value="1">Is it worth?</input>
</form>
服务器将接收值为1
的mycheckbox
.
The server would receive mycheckbox
with the value of 1
.
在PHP中,此POST变量存储为包含1
的$_POST['mycheckbox']
数组.
in PHP, this POST variable is stored in an array as $_POST['mycheckbox']
which contains 1
.
这篇关于value属性对HTML中的复选框意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文