Am facut interfata codul js si verificarea php dar codul js trimite date doar de la un singur buton .
Adica daca am mai multe invitatii trimise si doresc sa primesc recompensa de la mai multe butonul care imi da recompensa este activ doar pentru prima pozitie care apare in tabel
Acesta este codul :
prieteni_invitati.php
Cod: Selectaţi tot
<?php
$query_loto=mysql_query("SELECT * FROM add_prieten WHERE user= '$user' ORDER BY data");
$color="1";
echo '<table width="100%" align="center" cellpadding="2" cellspacing="0">
<tr><td colspan="4" style="padding:5px 0px 5px 15px; font-size:22px; border-top:solid #fff;">Invitatii trimise</td></tr><tbody >';
while($rand = mysql_fetch_array($query_loto, MYSQL_ASSOC)){
$stare= 0;
$mail_c=$rand['mail_inv'];
$q_cont= mysql_query("SELECT * FROM user WHERE adresa_mail='$mail_c' LIMIT 1");
if (mysql_num_rows($q_cont) == 1) {
$s_cont=mysql_fetch_assoc($q_cont);
if ($s_cont['activ'] == 1) {
$s_c= 1;
$stare= "<input type='hidden' value=".$s_c." name='s_cont' id='s_cont' /><img style='position:relative; left:-15px; top:8px;' src='images/ok_mark.png' alt='Activ' height='24' width='24' />";
} else {
$s_c= 0;
$stare= "<input type'hidden' value=".$s_c." name='s_cont' id='s_cont' /><img style='position:relative; left:-15px; top:8px;' src='images/peading.png' alt='Inactiv' height='24' width='24' />";
}
}else {
$s_c= 0;
$stare= "<input type='hidden' value=".$s_c." name='s_cont' id='s_cont' /><img style='position:relative; left:-15px; top:8px;' src='images/x_mark.png' alt='Neinregistrat' height='24' width='24' />";
}
echo "<tr style=' text-align:center;' ><td style='padding:5px;' colspan ='5' width='100%'>
<table id='t_colect' bgcolor='#FFC600' style='border:2px solid #62C1DE; ' >
<tr>
<td style='width:15%; width: font-size:16px; padding-left:10px; '>".$rand['nume_inv']."</td>
<td style='width:30%; font-size:16px; padding-left:10px; '>".$rand['mail_inv']."</td>
<td style='width:30%; font-size:16px; padding-left:10px; '>".$rand['data']."</td>
<td style='width:5%; text-align:center; font-size:16px; padding-left:10px; '>".$stare ."</td>
<td style='width:15%; padding-bottom:4px;'>
<input type='hidden' value=".$rand['colect']." name='s_col' id='s_col' />
<input type='hidden' value=".$user." name='s_user' id='s_user' />
<input type='hidden' value=".$rand['id']." name='s_id' id='s_id' />
<button name='colect' id='colect' />Colecteaza</button>
</td>
</tr>
</table>
</td></tr>
";
}
echo '<tr><td colspan="5"><span id="col_span"></span></td></tr>
<tr><td colspan="5" style="padding-top:10px; font-size:12px; border-top:solid #fff; color:#202020;" >
<img src="images/x_mark.png" alt="Neinregistrat" height="24" width="24" /> = Neinregistrat (Nu poti incasa bonusul)
<img src="images/peading.png" alt="Inactiv" height="24" width="24" /> = Inactiv (Nu poti incasa bonusul)
<img src="images/ok_mark.png" alt="Activ" height="24" width="24" /> = Activ (Poti incasa bonusul)
</td>
</tr>
</tbody></table></div></div></td></tr></table>';
?> Cod: Selectaţi tot
$(document).ready(function() {
$("#colect").click(function() {
var process = true;
$("#t_colect input").each(function() {
if ($.trim(this.value) == "") {
process = false;
}
});
if (process == true) {
var cont = $.trim($("#s_cont").val());
var stare =$.trim($("#s_col").val());
var user =$.trim($("#s_user").val());
var id =$.trim($("#s_id").val());
$("#col_span").html("<img src='images/loading.gif' height='20' align='absmiddle' />");
$.post("scripts/verificare_colect.php", { action: "check", stare: stare , cont: cont , user: user , id: id}, function(check_data) {
if (check_data == 0) {
$("#t_colect input, #t_colect button ").each(function() {
$("#"+this.id).attr("disabled", "disabled");
});
$("#col_span").html("<font color='#009900' size='-1'>Felicitari ai primit bonusul de puncte !</font>");
} else if (check_data == 1) {
$("#col_span").html("<font color='#ff0000' size='-1'>Ai primit deja bonusul din partea acestui prieten !</font>");
} else if (check_data == 2) {
$("#col_span").html("<font color='#ff0000' size='-1'>Prietenul tau inca nu si-a activat contul pentru a primi bonusul !</font>");
} else {
// Debugging
alert(check_data);
}
});
} else {
$("#col_span").html("<font color='#ff0000' size='-1'>Toate informatiile sunt obligatorii!</font>");
}
});
});Daca mai sunt informatii neclare va rog sa spuneti ! Multumesc ![/code]