how to get value of selected option in php code example
Example 1: php get option value
<?php
if(isset($_POST['submit'])){
if(!empty($_POST['Fruit'])) {
$selected = $_POST['Fruit'];
echo 'You have chosen: ' . $selected;
} else {
echo 'Please select the value.';
}
}
?>
Example 2: get the selected value of dropdown php
function run() {
document.getElementById("resultColorValue").innerHTML = document.getElementById("Color").value;
}