lundi 25 avril 2016

submit form when checkbox change in the same php page

i have this code:

<form id="form" method="post" action="">
<input type="checkbox" name="checkbox" onchange="$('#form').submit();">
<label class="onoffswitch-label" for="myonoffswitch">
    <span class="onoffswitch-inner"></span>
    <span class="onoffswitch-switch"></span>
</label>
</form>


if (isset($_POST['checkbox'])){
echo "ok";}

but the post of the checkbox doing nothing

can you help me sorry im newbie




Aucun commentaire:

Enregistrer un commentaire