Hi, I can easily access the value of a dynamically populated dropdown in PHP (example: $SelectedValue = $this->data("english_language_courses", 9);). How do I access the option text (displayed text) of the dropdown? Example: Selected dropdown item, which has a value of '24' displays 'General English Course'. '$SelectedValue' will return '24'. Now, if I need to assign 'General English Course' to '$SelectedText' what is the correct syntax?
Hi amitycol
This is only possible if you have an array in your PHP code matching values to texts:
$texts = ["24" => "General English Course"];
$selected_text = $texts[$this->data("english_language_courses")];
You need to login to be able to post a reply.