[Solved] Onchage pass 2 values

Nick Kalathis Asks: Onchage pass 2 values
Hello is there a way in a dropdown select element to pass in OnChange function 2 values, one of which should be the value selected and the other a PHP variable ?

something like this :

        $sql4 = "SELECT DISTINCT (color), id FROM mytable ORDER BY id ASC ";    
        $result4 = $conn->query($sql4);
    <select onchange="function(this.value,$row4['name'])" class="form-control selectpicker" data-size="10" data-live-search="true" data-style="btn-white" name="my_name" required  >
            if ($result4->num_rows > 0) 
                while($row4 = $result4->fetch_assoc()) 
        <option value="<?=$row4['id'];?>"><?=$row4['name'];?></option>
        <?php }}}?>

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.