The problem is when I click on the first class all classes data shown. I want when someone click on any class to only show that class data. I think the problemis in my query.
Here is my PHP code:
$x=$_POST['c_id'];
$sql = "select * from user1,classes where user1.clas=classes.c_id and id=id";
$resultset = mysqli_query($conn, $sql);
while( $rows = mysqli_fetch_array($resultset) ) {
?>
<tr>
<td><?php echo $rows['name'];?></td>
<td><?php echo $rows['class'];?></td>
</tr>
<?php }?>
My JavaScript code:
function selectclass(){
var x= document.getElementById("employee").value;
$.ajax({
url:"getstdata.php",
method:"POST",
data:{
c_id: x
},
success:function(data){
$("#ans").html(data)
}
})
}
All I want clicking on drop down on any class only shows the all that class students.
source https://stackoverflow.com/questions/76901620/fetching-data-drop-down
No comments:
Post a Comment