如何检索PHP POST中的自定义HTML属性? [英] How to retrieve custom html attribute in php POST?
问题描述
我有一个自定义复选框,它在Div中创建
$ p $ < div class =zsname =toggle state =onid =zs>< / div>
复选框已打开/关闭,状态属性在点击开启/关闭时发生变化。 p>
div放置在提交中,但我不知道如何从php获取$ _POST ['toggle']以接收属性state
浏览器只会通过输入
和选择
标签与表单提交,而不是 div
。这听起来像你可能想要将你的价值存储在隐藏的输入
中,IE:
< input type ='hidden'name ='toggle'value ='on'/>
然后添加到您已经使用的任何javascript,以适当地设置值。
I have a custom Checkbox its made in a Div
<div class="zs" name="toggle" state="on" id="zs"></div>
The checkbox has toggle on/off and the state attribute changes on click to on/off.
The div is placed in a for submittion but I dont know how to get $_POST['toggle'] from php to receive the attribute "state"
The browser is only going to send through input
and select
tags with the form submission, not div
. It sounds like you might want to store your value in a hidden input
, IE:
<input type='hidden' name='toggle' value='on' />
Then add to whatever javascript you're already using to set the value appropriately.
这篇关于如何检索PHP POST中的自定义HTML属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!