I am trying to use the first selection box to set the second selection box, based on what the first value was. Currently, I am trying to just set the second selection box to the value '2' because I cannot even get it to change. I have tried this...
if($row["usesize"] == 1){
?>
<table><tr><td><input type="hidden" name="on0" value="Size">
<td><select name="os0" onchange="$('#testid').val('2').change();">
<?php
if($conn){
$query = "SELECT size, color, quantity FROM `".$item."` group by size";
$result5 = $conn->query ($query);
if($result5->num_rows > 0){
while($row5 = $result5->fetch_assoc()){
?>
<option value="<?php echo $row5["size"];?>"><?php echo $row5["size"];?>
<?php
}
}
}else{
echo "Error".mysqli_error($conn);
}
?>
</select>
<?php
}
if($row["usecolors"] == 1){
?>
</td></tr><tr><td><input type="hidden" name="on1" value="Color">
<td><select name="os1" id="testid">
<option value="1">Test 1
<option value="2">2
<option value="3">Test 3
</select>
</td></tr>
<?php
}
I have tried searching for other ways to do it, but they all seem to come back to this option.
<select name="os0" onchange="$('#testid').val('2').change();">