checkbox - How to use a Toggle Switch in PHP -
I have a toggle in php that I would just like to use to change a value in a mysql table yet You know, this is an element of only one form, but how can I post / off value to switch / stop without using a 'submit' method?
& lt; Input data -no-uniform = "true" type = "checkbox" class = "iphone-toggle" & gt;
For now it is an input element with fancy css to make a check element in a switch element. So if there is a default position in the switch and just sliding the switch or "checking the box" will be enough to change the value in a cell
As you are using jQuery, you can do something like this:
$ ('.phone-toggle'). ('Change', function () {var toggle_data = $ (this) .data ('no-uniform') toggle_value = $ (this) .val (); $ .ajax ({type: "POST", url: 'Your_url.php', data: {toggle: toggle_data, value: toggle_value}, success: work () {// what do you do on success}})}};
and in php you will be assumed to be the value of $ _ POST ['toggle']
and $ _ POST ['value']
Query the database.
Comments
Post a Comment