2
I have this ajax that shows the items chosen in "checkbox" form.
$(document).ready(function(){  
      $('#submit').click(function(){  
           var languages = [];  
           $('.get_value').each(function(){  
                if($(this).is(":checked"))  
                {  
                     languages.push($(this).val());  
                }  
           });  
           languages = languages.toString();  
           $.ajax({  
                url:"form_cadastro.php",  
                method:"POST",  
                data:{languages:languages},  
                success:function(data){  
                     $('#result').html(data);  
                }  
           });  
      });  
 });
Html
<input type="checkbox" value="1"   class="get_value" name="redes_sociais">
<input type="checkbox" value="1"  class="get_value" name="site">
<input type="checkbox"  value="1" class="get_value" name="endereco">
<button type="submit" id="submit" class="btn btn-primary">Cadastrar</button>
PHP
if(isset($_POST["languages"]))  
 {  
      echo $_POST["languages"];  
 }  
My question is how can I enter the values of each input into the mysql database?
Mysql structure
$sql = "INSERT INTO planos (redes_sociais, site, endereco) VALUES
('".$_POST['redes_sociais']."', '".$_POST['site']."',".$_POST['endereco']."')";
						
When you send the parameter Languages via ajax, it will match the post, knowing this, I need to know what the value of $_POST["Languages"] to help you.
– Mauro Alexandre
this in my question I edited her
– Wagner Martins Bodyboard
I’m not sure what you want, in the "Mysql Structure" part, what exactly do you want to do? > My question is how to insert into BD .
– Mauro Alexandre
is that the values of the checkbox appears only with that echo $_POST["Languages"]; how could I insert into my mysql?
– Wagner Martins Bodyboard
That’s exactly what I want to know, what the value of $_POST["Languages"], is not in your post, and, you’re treating this in JS, sending as a single parameter to PHP.
– Mauro Alexandre
the value will always be "1" when selected. <input type="checkbox" value="1" class="get_value" name="social redes_social">
– Wagner Martins Bodyboard