PHP 只允许在表单中选择一个单选按钮
一个非常基本的问题...
我怎样才能只允许选择单选按钮列表中的一个选项?
<form action="process_repair.php" method="POST">
<label for "repair_complete">Repair complete</label>
<input type="radio" name="Yes" value="true">
<input type="radio" name="No" value="false">
</form>
当此代码运行时,可以选择两个单选按钮,但我希望它们能够交互,这样您只能选择其中一个。
非常感谢任何帮助! :)
A very basic question...
How can I only allow the selection of one option in a list of radio buttons?
<form action="process_repair.php" method="POST">
<label for "repair_complete">Repair complete</label>
<input type="radio" name="Yes" value="true">
<input type="radio" name="No" value="false">
</form>
When this code runs, it's possible to select both radio buttons, but I'd like them to interact so you can only select one or the other.
Any help much appreciated! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
给他们起同样的名字。
标签必须具有
for
属性,指向相应输入的id
。Give them the same name.
Labels must have a
for
attribute, directing to the corresponding input'sid
.每个输入应该有相同的“名称”
Every input should have same "name"