1
How to post the next item in a multi-item Mysql query?
When to change $( ".membro" ).change(function() {
) send the next data $("membro")
to the archive membros.php
, via $.post
.
JS:
$(".membro").change(function () {
$.post("membros.php", {
mes: $(".mes").val(),
ano: $(".ano").val(),
celula: $(".celulanome").val(),
membro: $(".membro").val()
});
});
HTML
<tr class=\"tabl\">
<td id=\"tabela2\" class=\"id\">$row[posicao]
</td>
<td id=\"tabela4a\">
<input type=\"hidden\" class=\"celulanome\" name=\"membro\" value=\"$celula\">
<input type=\"hidden\" class=\"mes\" name=\"membro\" value=\"$mes\">
<input type=\"hidden\" class=\"ano\" name=\"membro\" value=\"$ano\">
<input type=\"text\" class=\"membro\" name=\"membro\" value=\"$row[membro]\">
</td>
</tr>
<tr class=\"tabl\">
<td id=\"tabela2b\" class=\"id2\">$row[posicao]
</td>
<td id=\"tabela4b\">
<input type=\"hidden\" class=\"celulanome\" name=\"membro\" value=\"$celula\">
<input type=\"hidden\" class=\"mes\" name=\"membro\" value=\"$mes\">
<input type=\"hidden\" class=\"ano\" name=\"membro\" value=\"$ano\">
<input type=\"text\" class=\"membro\" name=\"membro\" value=\"$row[membro]\">
</td>
</tr>
<tr class=\"tabl\">
<td id=\"tabela2c\" class=\"id3\">$row[posicao]
</td>
<td id=\"tabela4c\">
<input type=\"hidden\" class=\"celulanome\" name=\"membro\" value=\"$celula\">
<input type=\"hidden\" class=\"mes\" name=\"membro\" value=\"$mes\">
<input type=\"hidden\" class=\"ano\" name=\"membro\" value=\"$ano\">
<input type=\"text\" class=\"membro\" name=\"membro\" value=\"$row[membro]\">
</td>
</tr>
PHP
<?php
include "bd_connect.php";
$membro=$_POST['membro'];
$celula=$_POST['celula'];
$mes=$_POST['mes'];
$ano=$_POST['ano'];
$posicao=$_POST['posicao'];
if (isset($membro))
{
$query = mysql_query("UPDATE contas2 SET membro='$membro' WHERE mes LIKE '$mes' AND ano LIKE '$ano' AND celula LIKE '$celula'") or die(mysql_error());
}
?>
Can you explain better what you mean by "post the next item"?
– Sergio
when the input changes ( $( ". member" ).change(Function() ? ) it sends the data to the members.php file ($. post)
– Alan PS
Yes, that I can see in c'I say but what is missing?
– Sergio
how I sent the value of the next "member" class, when changing the next input
– Alan PS
So when
$( ".membro" ).change(function() {
is triggered if I order not thismembro: $( ".membro" ).val()
but the value of the next member?– Sergio
@Sergio that’s right!!!
– Alan PS