我从单选按钮发布一个值,它的值是1,但当我回显var_dump($_POST)时,它显示为"on"而不是1。请帮忙。我需要得到1而不是"on"。
<input type="radio" id = "item" value="<?php echo $ItemID[0]; ?>"
name="ItemID"><label for="ItemID"><?php echo $ItemIDName[0]; ?></label>
浏览器生成的HTML
<input type="radio" id = "ITEMA"
value="1" name="ITEM"><label for="ITEMA">A</label>
<input type="radio" id = "ITEMB" value="2" checked="checked" name="ITEM" ><label for="ITEMB">B</label>
<input type="radio" id = "ITEMC" value="3" name="ITEM" >
<label for="ITEMC">C</label>
单选按钮的默认值为"on"!如果您的php代码$ItemID[0]
真的被设置为1,请检查它!
您需要将单选按钮的值设置为类似value="1"
的值,只有在选中时才会使用
该值设置定义了选中后将提交的内容。