Forums

Dropdown classic multiline option list from a PHP variable - how to add line breaks

rikulahteenmaki 18 Feb, 2024
I am generating a dropdown options list from a PHP variable. Adding "\r\n" to end of each line in the variable data does not make new lines, when the dropdown is rendered in the form. I only get one long string as a selection option, instead of a list of multiple selection options.
How can I get the new lines show in the selection list?
I have Linux and Firefox browser.
rikulahteenmaki 19 Feb, 2024
Answer
1 Likes
SOLVED: the drop select options show correctly, when the PHP variable is returned as an array. You do not need to explode the array into a string at all, thus avoiding the new line character issue.
You need to login to be able to post a reply.