我怎样才能从php中获取标签信息,以便在下拉列表的值发生变化时进行更改?

I have been looking at this code for probably 4 hours now trying to get it to do what I want. I want it so that when a new value is put in the dropdown menu the label below will update, but the information is coming from PHP though. How would I do this cause I have looked everywhere and I can't find something that would help. I think I saw somewhere that I can't do it like this with PHP since it is processed server side not client side, if that is true can you tell me what I am supposed to do?

<?php
echo "<script type='text/javascript'>
        function updatePrice()
        {
                var x = document.getElementById('partNumber').value;
                document.getElementById('price').innerHTML = 'HERE I AM ' + x;";
//              $pricesql = "SELECT partPrice FROM Parts WHERE partID = "document.getElementById('partNumber').value;;
                $priceresult = $pdo->query($pricesql);

echo "}
</script>";
?>

JavaScript allows you to update page contents dynamically without reloading the page, so if your application is static (no database) then you can use JavaScript, otherwise you have to use Ajax to send/receive data from the server using PHP as example.

so you have to read about JavaScript and Ajax to solve the problem.

best regards