PHP Toggle switch Update DB field using jQuery Ajax

Today, We want to share with you PHP Toggle switch Update DB field using jQuery Ajax.
In this post we will show you Bootstrap Switch using PHP and MySQL, hear for store value from on/off button in mysql database using php ajax we will give you demo and example for implement.In this post, we will learn about PHP Ajax Update MySQL Data Through Bootstrap Modal with an example.

PHP Toggle switch Update DB field using jQuery Ajax

There are the Following The simple About PHP Toggle switch Update DB field using jQuery Ajax Full Information With Example and source code.

READ :  PHP Sorting a Nested Associative Array Using a Recursive Function

As I will cover this Post with live Working example to develop Create Radio Button Toggle Switch with Bootstrap, jQuery & PHP, so the some major files and Directory structures for this example is following below.

  • index.php
  • radio_toggle.js
  • save.php
  • style.css

Steps 1: Make HTML Form with Radio Button

index.php

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.

[php]

READ :  Angular 6 PHP CRUD (Create, Read, Update, Delete) Operations

[/php]

Steps 2: Make custom CSS style

create custom CSS style.css file and make class inCurrent
[php]
.inCurrent{
color: #c6000;
background-color: #3d3d3d;
}
[/php]

Steps 3: Manage Radio Button Toggle

radio_toggle.js
[php]
$(document).ready(function(){
$(“#status_radio a, #check_radio a”).on(‘click’, function(){
var checked = $(this).data(‘title’);
var toggle = $(this).data(‘toggle’);
$(‘#’+toggle).prop(‘value’, checked);
$(‘a[data-toggle=”‘+toggle+'”]’).not(‘[data-title=”‘+checked+'”]’).removeClass(‘active’).addClass(‘inCurrent’);
$(‘a[data-toggle=”‘+toggle+'”][data-title=”‘+checked+'”]’).removeClass(‘inCurrent’).addClass(‘active’);
})
});
[/php]

Steps 4: Manage Form Submit POST Values

save.php
[php]

[/php]

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about bootstrap toggle switch update db field using ajax,.
I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

READ :  AngularJS filter capitalize First letter of Every word

Leave a Comment