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

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -