Question: how to retain selected value of dropdown in php after submit?
Answer: 1 Answer. You have to set the selected attribute for the option that was submitted. So you have to check the submitted value for each option. In my solution I am using the ternary operator to echo the selected attribute only for the correct operator.