Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
Storing Radio Buttons in Database via JS

I have 15 questions, every question must be answered. You can answer with Radio Buttons. Now I want to store every clicked radio button in a Database. I hope someone can help, I do not how this works. If someone hast a website for me, feel free to post it, I'll try it on my own. Here is the code. I have no idea if this is somehow right. Thank you in advance. Radio Buttons are stored this way and then the JS function:

`
 <input type="radio" id="Q15one" name="valuation15" value="one">
        <label for="one"> 1</label> 
        <input type="radio" id="Q15two" name="valuation15" value="two">
        <label for="two">2</label>
        <input type="radio" id="Q15three" name="valuation15" value="three">
        <label for="three">3</label> 
         <input type="radio" id="Q15four" name="valuation15" value="four">
        <label for="four">4</label> 
        <input type="radio" id="Q15five" name="valuation15" value="five">
        <label for="five">5</label>

    alert('Please answer every question.'); 
    else {
    uservalues=[2,3,4,5]
        safevalues(2,uservalues)

    location.href='page3circle.html';
}
}
function safevalues(values){
  var db = openDatabase('AIdb.db', '1.0', 'AI within medicine', 2 * 1024 * 1024);
  db.transaction(function (tx) {
    tx.executeSql('CREATE TABLE survey IF NOT EXISTS (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, question1 TEXT, question2 TEXT, question3 TEXT,question4 TEXT,question5 TEXT,question6 TEXT,question7 TEXT,question8 TEXT,question9 TEXT,question10 TEXT,question11 TEXT,question12 TEXT,question13 TEXT,question14 TEXT,question15 TEXT, timestamp TIMESTAMP)');
    if (radioGroup.getCheckedRadioButtonId()!=0){
      tx.executeSql('INSERT INTO survey (question1, timestamp) VALUES (?, ?)', [radioGroup.getCheckedRadioButtonId()], new Date());
    }

  if (page==2) {
    tx.executeSql('INSERT INTO survey (question1,question2, question3, question4, timestamp) VALUES (?, ?,?,?)', [radioGroup.getCheckedRadioButtonId(), radioGroup.getCheckedRadioButtonId(),radioGroup.getCheckedRadioButtonId(),radioGroup.getCheckedRadioButtonId(),new Date()]);
    
  }
  else{}
}
);`
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda