php - Checkboxes with FormData.Append -
i using javascript formdata.append pass values php file, cannot check boxes working. example
html
<input type="checkbox" name="xxx" value="xxx" /><label>xxx option</label>
js
formdata.append( 'xxx', $('input[name=xxx]').val());
php
if (isset($_post['xxx'])) { echo "checked!";}
whether check box or not, response - checked!
or php
$xxx= $_post['xxx'];
the var $xxx shows value xxx whether checked or not.
how can pass checkboxes using method can differentiate if checkbox ticked or not!
try using
document.getelementsbyname('xxx')[0].checked
to check status of whether it's checked or not.
Comments
Post a Comment