I am having some trouble with an onchange event. The task is a large section of code for sorting data but to try through isolating code ive tracked it down to the onchange event not actually working and I cant see whats wrong.
<?php include("db_connect.php");
$query = 'SELECT * FROM db_class_catagories';
$result = mysqli_query($dbconnection,$query);
?>
<select id="primary_catagory" name="primary_catagory" onchange = "test_function(this)"style="position:absolute;left:10px;top:10px;width:315px;height:20px;z-index:11;text-align:left;">
<option value=''>Select</option>
<?php while ($row = mysqli_fetch_array($result, MYSQL_ASSOC)){
echo "<option value='" . $row['primary_catagory'] . "'>" . $row['primary_catagory'] . "
</option>";}
?>
</select>
<?php
function test_function($primary_catagory) {
echo $primary_catagory;
}
?>
This list is being generated from a database and is being called perfectly well, but no matter what I select nothing will happen. The main script used AJAX but again nothing was occuring and all I could think of is the onchange is not sending data.
I was using this example but couldnt get it working. How can i populate a dropdown list by selecting the value from another dropdown list
My task is more or less the same but something is not right with my onchange, any idea what daft thing im missing? thanks