0
I’m trying to make a dynamical Insert using ajax. as shown in the image below. I want to be able to click send from any line and do the post referring to it
How can I do that
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<table style="width: 20%;">
<thead>
<tr>
<th style="width: 1%;" class="center">Cod.</th>
<th style="width: 18%;" >Produtos</th>
<th class="text-center" style="width: 8%;">Valor</th>
<th style="width: 5%;"></th>
</tr>
</thead>
<tbody>
<?
$cmd = "SELECT * FROM produtos where id_transfer = '1' limit 5";
$produtos = mysql_query($cmd)or die( mysql_error());
$count=mysql_num_rows($produtos);
while ($linha = mysql_fetch_array($produtos)) {
$id_produto = $linha['id_produtos'];
$id_transfer = $linha['id_transfer'];
$cheva = $linha['chave'];
?>
<tr class="selectable">
<td class="center"><input type="text" id="campo1" value="<?echo $id_transfer1?>" /></td>
<td class="important"><input type="text" id="campo2" value="<?echo "$id_produto"?>" /></td>
<td class="text-center"><input type="text" id="campo3" value="<?echo $chave?>" /></td>
<td class="center">
<input type="submit" class="btn btn-danger" onclick="inserir_registo()" /><i class="fa fa-arrow-right"></i></i></a>
</td>
</tr>
See if it has anything to do with having a
$cheva = $linha['chave'];
and a<?echo $chave?>
. Typo?– Thiago Lunardi
That variable doesn’t even make a difference. independent of any variable you have only sends the while pepper line let’s say the first line has id 1 the second 2 ...... only sends id 1
– Fabio Henrique
But why didn’t you just put an upload button? and the fields in array format? Because then when it’s time to send, send everything at once and record the filled...
– Sr. André Baill
Because in fact all these fields will stay hidden, only the buttons will appear. because this , this system will stay on a touch screen and I wanted to just click on the item is already included for the base
– Fabio Henrique