简体   繁体   中英

How to retrieve custom html attribute in php POST?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM