-1
I have a table with the INCLUDE button containing the following code:
<td align="center"><input type="button" class="add" onclick="add_row(<?php echo($id_usuario); ?>, 0);" value="INCLUIR"></td>
The.js table file contains func add_row() with the following code:
function add_row(pid_usuario,pdia_da_semana)
{
var inicio=document.getElementById("inicio").value;
var fim=document.getElementById("fim").value;
window.alert('ENTROU');
//INCLUIR_REGISTRO(pid_usuario, pdia_da_semana, inicio, fim);
var table=document.getElementById("data_table");
var table_len=(table.rows.length)-1;
var row = table.insertRow(table_len).outerHTML="<tr id='row"+table_len+"'><td id='inicio_row"+table_len+"'>"+inicio+"</td><td id='fim_row"+table_len+"'>"+fim+"</td><td align='center'> <input type='button' value='EXCLUIR' class='delete' onclick='delete_row("+table_len+")'></td></tr>";
document.getElementById("inicio").value="";
document.getElementById("fim").value="";
}
Basically what I do with the include button is add a new row to table.
So I thought.. Since I’m adding the line why not include the record at this point.
Here comes the lack of experience.. I have no idea how to do the job INCLUIR_REGISTRO()
.
Could one of my more experienced colleagues help me?
Good afternoon ISAC.. In the add_row function I include a line in the <TABLE> object. If you notice, when Gero a <tr> and <td> they have different IDS that was passed by the TABLE_LEN variable. So I generated this line and now I want to GENERATE INSERT in the appropriate table.
– Ricardo M.Souza
Correct. And what do you mean by record? The function
INCLUIR_REGISTRO()
What exactly are you supposed to do?– Isac
Ola. a função INCLUIR_REGISTRO(pid_usuario, pdia_da_semana, pinicio, pfim) seria algo do tipo: Insert into tabela (id_usuario, dia_da_semana, inicio, fim) values (pid_usuario, pdia_da_semana,pinicio, pfim). execsql;
– Ricardo M.Souza
For this it is necessary to use Ajax and send the data to the php page that will take them insert into the corresponding table and return the result of the operation
– Isac