here is my code. i am having different ids for input elements and my idea is to update the same value to the all inputs. i am having the idea how to update the all inputs onchange but i need to change the next but not previous. Example suppose if i have 20 inputs if i change the 8th input the value should be updated to all the inputs from 8th to 20th input but the previous 7 inputs should not be changed. i stuck up here how to write the code.
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.tc').change(function(){
var id=$(this).attr("id");
var val=$(this).val();
var tot=$('.tc').length;
});
});
</script>
</head>
<body>
<?php
include('connect.php');
$yr=$_POST['year'];
$sm=$_POST['sem'];
$br=$_POST['branch'];
$k=0;
$sql="select * from intstd where year='$yr' and sem='$sm' and branch='$br'";
$query=mysql_query($sql);
echo"<table>";
while($row=mysql_fetch_array($query))
{
$k++;
echo"<tr>";
echo"<td>$k</td>";
echo"<td>". $row['rollno']."</td>";
echo"<td><input type='text' name='a[]' class='tc' id='$k' /></td>";
echo"<td><input type='text' name='b[]' id='$k' /></td>";
echo"</tr>";
}
echo"</table>";
?>
</body>
</html>