I have a web program where the goal is plot data points for a certain Kiln that the user has selected. My problem is when a user wants to select a new Kiln, how can I update all the separate JSON pages to where the data is pulled from the new table they selected?
Here is my drop down list creater code.
<p class="navleft">
Kiln Number:<br>
<select name="kilns" id="kilns">
<?php
$sql = "SHOW TABLES FROM history";
$result = mysqli_query($con,$sql);
while($table = mysqli_fetch_array($result)) { // go through each row that was returned in $result
 echo ("<option value='". $table[0] . "'>" . $table[0] . "</option>");
}
?>
</select>
</p>And here is one of the php pages where I select all the data from a value in a table and turn it into a JSON file.
<?php
$con = mysqli_connect("localhost","KilnAdmin","KilnAdmin","history");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
mysqli_select_db($con,"history") or die ("no database");   
//Fetch Data
$query = "SELECT * FROM k1_history LIMIT 1000";
$result = mysqli_query($con,$query);
if ($result) {
 $data = array();
 while($row = mysqli_fetch_assoc($result)) {
  //$data[] = $row;
        $data[] = array(
    "date" => $row[ 'Timestamp' ],
    "value" => $row[ 'DryBulbFront' ]
  );
    }
 echo json_encode($data);
}
else {
 echo "Error";
}
?> Where is says k1_history, how can I get that to be the selection from the user in the dropbox menu from the other page?
 
     
     
    