javascript - undefined index while submitting the form -
i want submit form empty checkbox want value "no" if checkbox not checked.
if($domain_check=="yes") { echo '<div class="col-md-3"> <div class="form-group" style="padding-top:20px;"> domain_check <input type="checkbox" name="domain_check1" value="yes" checked> </div> </div>'; } else { echo '<div class="col-md-3"> <div class="form-group" style="padding-top:20px;"> domain_check <input type="checkbox" name="domain_check1" value="yes"> </div> </div>'; }
use hidden input before checkbox set default value same name:
<input type="hidden" name="domain_check1" value="no"> <input type="checkbox" name="domain_check1" value="yes">
the hidden input overridden if checkbox checked.
Comments
Post a Comment