How do I get the tag value of option with php?

<form action="" method="post">
<select name="Color">
<option value="Red">myRed</option>
<option value="Green">myGreen</option>
<option value="Blue">myBlue</option>
<option value="Pink">myPink</option>
<option value="Yellow">myYellow</option>
</select>
<input type="submit" name="submit" value="Get Selected Values" />
</form>

<?php
if(! empty($_POST["submit"])){
$selected_val = $_POST["Color"];  
echo "You have selected :    " .$selected_val; 
}

  myPink

click

You have selected : Pink

what I need now is to display the value of the tag corresponding to the option I selected, that is,
wants to output
You have selected: myPink

excuse me, is there any php available to do this?

Apr.09,2021

1. Change the value of option to the same value as the name
2. Or concatenate the postvalue in php my

is purely a foolish opinion, for reference only


agree with the other answer.

or you can add a hidden form to form. The value is the value of the tag you mentioned (of course, it needs to be changed dynamically by js listening), and then you can upload it together when you post.

Menu