テーブルの行の1つを左側のラジオボックスでマークしたいajaxテーブルがあります。問題は、javascriptが苦手なことです。このテーブルからIDでラジオボックスの値を取得したいマークされていますが、実際にはこの ajax テーブルは while ループと配列を使用してデータベースからの情報を表示します。javascript を使用して、ラジオ ボックスで選択した行の情報を取得または返すためのコードを誰でも記述できますか。
これは私のajaxテーブルです:
<?php
session_start();
?>
<?php
$connection = mysql_connect('localhost', '', '');
$db = mysql_select_db('students', $connection);
mysql_query("SET CHARACTER SET utf8;");
mysql_query("SET SESSION collation_connection = 'utf8_persian_ci'");
$term = strip_tags(substr($_POST['searchit'],0, 100));
$term = mysql_escape_string($term); // Attack Prevention
if($term=="")
echo " .enter a usernumber";
else{
$query = mysql_query("select * from test where username like '{$term}%'", $connection);
$string = '';
echo "<br>";
echo "<center>";
echo "<div>";
echo "<div align='center' width = 900>";
echo "<table class='styled-table' cellspacing='0' width='900' border='1'>";
echo "<tr>";
echo "<th width='10' scope='col'>Check</th>";
echo "<th width='10' scope='col'>Username</th>";
echo "<th width='10' scope='col'>Password</th>";
echo "<th width='10' scope='col'>Name</th>";
echo "<th width='10' scope='col'>Last Name</th>";
echo "<th width='10' scope='col'>Midterm</th>";
echo "<th width='10' scope='col'>Class Mark</th>";
echo "<th width='10' scope='col'>Final</th>";
echo "<th width='10' scope='col'>State</th>";
echo "<th width='10' scope='col'>Level</th>";
echo "<th width='10' scope='col'>Teacher</th>";
echo "<th width='10' scope='col'>Class Num</th>";
echo "<th width='10' scope='col'>Receipt</th>";
echo "<th width='10' scope='col'>Date</th>";
echo "</tr>";
if (mysql_num_rows($query)){
while($row = mysql_fetch_assoc($query)){
echo "<tr>";
echo "<td align='center'><input class='styled-input' type='checkbox' name='check' id='check' value= " . $row['check'] ." ></td>";
echo "<td align='center'><input class='styled-input' type='text' name='user' id='user' value= " . $row['username'] ." ></td>";
echo "<td align='center'><input class='styled-input' type='text' name='pass' id='pass' value= " . $row['password'] ." ></td>";
?> <td align='center'><input class='styled-input' type='text' name='name' id='name' value= "<? echo $row['name']; ?>" ></td>
<td align='center'><input class='styled-input' type='text' name='lastname' id='lastname' value= "<? echo $row['lastname']; ?>" ></td>
<td align='center'><input class='styled-input' type='text' name='midmark' id='midmark' value= "<? echo $row['midmark']; ?>" ></td>
<td align='center'><input class='styled-input' type='text' name='classmark' id='classmark' value= "<? echo $row['classmark']; ?>" ></td>
<td align='center'><input class='styled-input' type='text' name='finalmark' id='finalmark' value= "<? echo $row['finalmark']; ?>"></td>
<td align='center'><input class='styled-input' type='text' name='state' id='state' value= "<? echo $row['state']; ?>" ></td>
<td align='center'><input class='styled-input' type='text' name='level' id='level' value= "<? echo $row['level']; ?>" ></td>
<td align='center'><input class='styled-input' type='text' name='teacher' id='teacher' value= "<? echo $row['teacher']; ?>" ></td>
<?php echo "<td align='center'><input class='styled-input' type='text' name='classnum' id='classnum' value= " . $row['classnum'] ." ></td>";
echo "<td align='center'><input class='styled-input' type='text' name='receipt' id='receipt' value= " . $row['receipt'] ." ></td>";
echo "<td align='center'><input class='styled-input' type='text' name='date' id='date' value= " . $row['date'] ." ></td>";
echo "</tr>";
$_SESSION["suser"]=$row['username'] ;
if(($row['check'])==true)
{$_SESSION["sreceipt"]=$row['receipt'] ;}
}
echo "</table>";
echo "</div>";
echo "</div>";
echo "</center>";
}else{
$string = "nothing found !";
$_SESSION["suser"]='';
$_SESSION["sreceipt"]='';
}
echo $string;
}
?>