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

164
Visualizações
How do I insert multiple rows to the database?

I am implementing a function to add a table row when a button is clicked.

Below is the table.

<table id="table">
    <tr>
        <td>num</td>
        <td>name</td>
        <td>procedure</td>
        <td>expect</td>
    </tr>
    <tr>
        <td><h4></h4></td>
        <td><input type="text" name="testCaseName" id="testCaseName"></td>
        <td><textarea name="testProcedure" id="testProcedure" onkeydown="resize(this)" onkeyup="resize(this)"></textarea></td>
        <td><input type="text" name="expect" id="expect"></td>
    </tr>
    <tr>
        <td>
            <input type="button" value="addRow" onclick="addRow()"></input>
            <input type="submit" value="submit">
        </td>
    </tr>
</table>

Below is the add row function.

function addRow() {
    var table = document.getElementById("table");
    var row = table.insertRow(0);
    var cell1 = row.insertCell(0);
    var cell2 = row.insertCell(1);
    var cell3 = row.insertCell(2);
    var cell4 = row.insertCell(3);
    cell1.innerHTML = "<h4></h4>";
    cell2.innerHTML = "<input type='text' name='testCaseName' id='testCaseName'>";
    cell3.innerHTML = "<textarea name='testProcedure' id='testProcedure' onkeydown='resize(this)' onkeyup='resize(this)'></textarea>";
    cell4.innerHTML = "<input type='text' name='expect' id='expect'>";
}

If you do this the problem

It is very natural, but when it is saved in the database after submitting, it is all saved in one row.

I want to add one row to the database for each row added, but please advise on how to do it.

about 4 years ago · Santiago Gelvez
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