Skip to content Skip to sidebar Skip to footer

Saving Values Of Toggle(yes Or No) In Database Php

i am trying to use toggle buttons to save response in db as yes or no. for some reason the only response i am getting is 'on'. even when i switch off the button. i tried searching

Solution 1:

By writing a php command you are setting the initial value of that input into m11. You have to catch the client side value of input instead:

your code:

var m11 = '<?phpecho$_POST['handicap']; ?>'; // always returns the initial value

Correct clien-side code:

var m11 = $(this).val();

Post a Comment for "Saving Values Of Toggle(yes Or No) In Database Php"