javascript - Read and Save only Checked Radio Button to a "particular column in MYSQL" | PHP & Ajax -


technologies used:

  • server side: php
  • db: mysql
  • client side: ajax call php
  • client side: html
  • usable on: phonegap

i have 4 radio button in radio group in html

  1. mother
  2. father
  3. self
  4. others

the 4 columns in table are:

| dbmother | dbfather | dbself | dbothers | 

if choose mother radio button, value should go , save right under column dbmother, rest of columns should remain blank.

when choose radio button self in html, value should go , save right under mysql db column dbself , remaining columns should remain blank.

i have tried few codes available on google, these saving information in 1 single db column.

i think need codes php server side , ajax client side.

<html> <head>   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">   </script>   <script type="text/javascript">     $(document).ready(function(){        $("#submit").click(function(){          var game=$('input[type="radio"]:checked').val();          if($('input[type="radio"]:checked').length == "0") {           alert("select value");         }         else {           $.ajax({             type: "post",             url: "ajax-check.php",             data: "game="+game,             success: function() {               $("#msg").addclass('bg');               $("#msg").html("value entered");             }           });         }         return false;       });     });   </script> </head> <body>   <div id="msg"></div>   <form method="post" action="">     select:<br/>     <input type="radio" name="game" value="mother">     <input type="radio" name="game" value="father">     <input type="radio" name="game" value="self">     <input type="radio" name="game" value="others">     <input type="submit" name="submit" id="submit">   </form> </body> </html> 


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -