I have code to return options for a dropdown box from a query. I have the function set up and the code it's grabbing from. When I check the appraisal_options.php page it shows the correct amount of items in the dropdown, but when I go to the page that is calling it, it doesn't show any of the results from the query lines. It does return the 'test' result that's manually coded.
function loadMake(dropdown_type) {
const xhttp = new XMLHttpRequest();
xhttp.onload = function () {
document.getElementById( "make" ).innerHTML = this.responseText;
}
xhttp.open( "GET", "appraisal_options.php?type=" + dropdown_type, true );
xhttp.send();
}
/// Get results for Make from Type
if ( $_GET['type'] ) {
$type = $_GET[ "type" ];
echo "<select id='make' name='make'> <option value='none' selected> Select a Make</option>";
$make_query = mysqli_query( $con, "SELECT DISTINCT Make FROM UnitsOptions WHERE Type = '$type'" )or die( mysqli_error() );
while ( $return = mysqli_fetch_array( $make_query ) ) {
echo "<option onclick='loadYear()' value='".$return['Make']. "'>".$return['Make']."</option>";
}
echo "<option value='none' onclick='loadYear()'> test</option> </select>";
}