lundi 29 octobre 2018

Set a checkbox as 'checked' when an if condition is fulfilled in php

I want to mark a checkbox as 'checked' automatically when an if condition is fulfilled. Here is an example of the if condition-

if($wp_session['tdwa_verification_checks'] < 2){

}

And the checkbox is-

<input class="input-text a-save" type="checkbox" id="chkboxclicked" name="tdwa-foreign-citizen" value="1">

I am trying with this but its not working.

if($wp_session['tdwa_verification_checks'] < 2){

    echo '<input class="input-text a-save" type="checkbox" id="chkboxclicked" name="tdwa-foreign-citizen" value="1" checked>'; 

}

I would appreciate if anyone can give me a clue. Thanks :)




Aucun commentaire:

Enregistrer un commentaire