Pass value parameter when clicking input type radio, with php, jquery and mysql propagating

1

Hello, everyone, I have a question, I do not know how to proceed, I need to send the value that is inside the value input type radio to a jquery variable, remembering that I got it but only works the first one on the list that was propagated with mysql. '

        <script type='text/javascript' >

    $(function(){
 $('#sbt_click1').click(function() {
	var id = $(this).val();
	alert( 'Chegou o id: '+ id );
	$.ajax({
		type:"POST",
		url:"functions/ass_arm_session_id_asso.php?id="+id,
		dataType:"text",
	
	
});
});
});
</script>
 <?php
$sql_lista = mysql_query("SELECT*FROM ass_log as c1 
inner join ass_associado as c2 on c2.id_ass = c1.log_associado 
inner join ass_at_des as c3 on c3.id_at_des = c1.log_at_des");
while($resultado = mysql_fetch_array($sql_lista)){
										?>
<INPUT TYPE="RADIO" name="sbt_click1" id="sbt_click1" VALUE="<?php echo $resultado['id_ass'];?>"><?php } ?>

'If someone knows how to send it, I could not trigger the others.

    
asked by anonymous 29.08.2016 / 20:01

1 answer

2

Can not contain repeated Ids in html, so you can correct using classes as follows:

Switch

$('#sbt_click1')

by

$('.sbt_click1')

and switch:

id="sbt_click1"

POR

class="sbt_click1"

I believe this will solve.

    
29.08.2016 / 20:09