粘性复选框
我正在尝试设置一个复选框(通过电子邮件发送)粘性。
为了确保发送空时不会出现问题,我使用了以下内容:
<input type="checkbox" name="something" value="1">
<input type="hidden" name="something" value="0">
我使用过以下内容:
<input type="checkbox" name="something" value="1" <?=(($_POST['something']=='1')?'checked="checked"':'')?>>
但它不起作用。 有人可以帮我吗?非常感谢弗朗西斯科
Ii am trying to make a checkbox (to send via email) sticky.
To make sure it doesn't make a problem when sent empty I used the following:
<input type="checkbox" name="something" value="1">
<input type="hidden" name="something" value="0">
I have used things such as:
<input type="checkbox" name="something" value="1" <?=(($_POST['something']=='1')?'checked="checked"':'')?>>
But it does not work.
Can someone please help me? Many thanks Francesco
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
人们可以解释为“粘性”意味着用户无法取消选中该复选框。这可以使用
disabled="disabled"
属性来实现。然而,顺便说一句,强迫人们订阅某些电子邮件列表是不太礼貌的……
One could interpret that sticky means that user cannot uncheck the checkbox. That would be achieved using
disabled="disabled"
attribute.As a side note, however, it wouldn't be very polite to force people to subscribe to some email list...
您的意思是
已检查
吗?如果是这样,那么它将是
希望我理解正确
Do you mean
checked
?If so then it would be
<input type="checkbox" name="something" value="1" checked="checked" />
Hope I understood that correctly