I have a php variable called $photographerNum that i want the value of to change depending upon value in my drop down field on my page, what would the javascript look like for this as well as how to receive the new value to update the php variable?
<!DOCTYPE html>
<html>
<body>
<? $photographerNum = 1; ?>
<p>Select an item from the list.</p>
<select id="photographerNum" onchange="myFunction()">
<option value="Item1">Item1
<option value="Item2">Item2
<option value="Item3">Item3
<option value="Item4">Item4
</select>
<script type="text/javascript">
function myFunction() {
var itemSelected = document.getElementById("photographerNum").value;
document.getElementById("demo").innerHTML = "You selected: " + itemSelected ;
}
</script>
<p id="demo"> - photoNum=<? echo $photographerNum ?></p>
</body>
</html>