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

Asked

Viewed 405 times

2

Hello, good afternoon everyone, guys I’m having a doubt I do not know how to proceed I need to send the value that is inside the value input type radio to a variable jquery remembering that I even got but only works the first of 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 anyone knows how to send because I could not trigger the other

  • Take a look at this link, I think you will find the answer to your error https://stackoverflow.com/questions/596351/how-can-i-know-which-radio-button-is-selected-via-jquery

1 answer

3


Cannot contain repeated Ids in html, so you can fix using classes as follows:

Change

$('#sbt_click1')

for

$('.sbt_click1')

and change:

id="sbt_click1"

FOR

class="sbt_click1"

I believe that solves.

  • Guy Thank you so much it was lack of attention rsrs I am to more than 12 hours without rest, I will stop now Valew friend

Browser other questions tagged

You are not signed in. Login or sign up in order to post.