title: Retrieve data from a form using jquery
body: <p>I'm trying to get information from a form and passing it to mysql. Here is my method:</p>
  
  <pre><code>var form = [];
  
  $("input").each(function(){
  var id = $(this).attr("name");
  var value = $(this).val();
  alert(id);
  
  var item = {};
  item ["name"] = id;
  item ["value"] = value;
  
  form.push(item);        
  });
  
  return JSON.stringify(form);
  </code></pre>
  
  <p>The problem is when i try to get the checked and unchecked values from the radio buttons. The query string that I want to pass to mysql outputs like this:</p>
  
  <p><code>insert into contatos (nome, rua, sexo, sexo, ncasa, civil, civil, civil, bairro, aniversario, cidade, rg, cpf, usuario, telefone, senha, email, confirmasenha) values ('', '', 'M', 'F', '', 'S', 'C', 'D', '', '', '', '', '', '', '', '', '', '')</code></p>
  
  <p>The fields "sexo" and "civil" are repeating. How do I make the input to read the radio buttons only 1 time?</p>