<?php

$change_class=$_POST["change_class"];


echo "

<select class='form-control' name='schoolclass' onchange='std(this.value)'>

<option value=''>Class</option>";



include("../core/connect.php");

$result_kingslanding=$dbh->query("select distinct(schoolclass) from kingslanding where setid='$change_class'");

$row_kingslanding=$result_kingslanding->fetchObject();

$count_kingslanding=$result_kingslanding->rowCount();



if($count_kingslanding>0){

do{

$result_scrap=$dbh->query("select * from scrap where item='$row_kingslanding->schoolclass'");

$row_scrap=$result_scrap->fetchObject();



echo "<option value='".$row_scrap->item."'>".$row_scrap->item2."</option>";

}while($row_kingslanding=$result_kingslanding->fetchObject());

}else{

    echo "<option value=''>So far, there is NO data here. </option>";

}



echo "</select>";



?>