Radio button issue

Hey guys so I have this table in a page that is populated by data from database using mysql. There are 4 columns: name, unconfirmed, attending, not attending. The last 3 columns are radio buttons. All the columns in the table are echoed even the radio buttons.


<table class="rsvp-guest-table">
			<thead>
				<tr>
					<th style="width:100px;text-align:center">Guests</th>
					<th colspan="3" style="text-align:center">Status</th>
				</tr>
			</thead>
			<tbody>
					<?php
							require "connection.php";
							
							$check = mysql_query("SELECT * FROM contact") or die(mysql_error());
							if(mysql_num_rows($check) > 0)
							{
								while($row = mysql_fetch_array($check))
								{
									$salutation = $row['salutation'];
									$name = $row['primary_name'];
									
									echo
									"<tr>
										<td>$salutation $name</td><td>Unconfirmed<input type='radio' name='rsvp[1]' class='radio' data-col='1' value='unconfirmed'></td><td>Attending<input type='radio' name='rsvp[2]' class='rad' data-col='2' value='attend'></td><td>Not Attending<input type='radio' name='rsvp[3]' class='radi' data-col='3' value='notattend'></td>
									</tr>";
								}
							}	
							else
								{
									echo
									"<tr>
										<td colspan='4'>Choose an Event from the list.</td>
									</tr>";
								}
						?>
				</tbody>
		</table>

screenshot if table:

issue:
according to the image the first name : Xaviera I clicked unconfirmed but when I clicked unconfirmed for second name: Asma; unconfirmed for Xaviera was unclicked(like the choice for unconfirmed moved from Xaviera to Asma) and well that’s not friendly is it. ALSO notice that for Xaviera both radio buttons unconfirmed and not attending are clicked. I think that has to do with the naming convention :

name=‘rsvp[1]’, name=‘rsvp[2]’, name=‘rsvp[3]’

first i thought it was something that i could get around with playing with the html because the radio buttons were in html/php then realized maybe some jquery could help me out. but,embarassed to say, my js/jquery knowledge is a bit on the low side. if someone could give me some ideas/suggestions or just point me to the right docs to read up that could help me with this radio button prob that’s be great.

thanks in advance!

Indeed. You’ve basically asked this question before, and gotten an answer. (Rather than post new threads, keep the disucussion going where it’s already started.) It won’t be enough to echo the same code for each person, because if you have radio buttons with the same name value, they’ll be alternatives to each other. So the names for each user need to have something unique inserted into them to make them a unique set. Do that with PHP. JS is not the tool for this.

As said before, keep the same name for each radio button in a row, and just change their values. For each new row, have a different name shared between each button.