and html where I need to display (echo selected result)
<textarea id="customer-title">
echo column 1 (based on selection in dropdown list)
echo column 2 (based on selection in dropdown list)
echo column 3 (based on selection in dropdown list)
</textarea>
Well, assuming you’re submitting the form, your value in PHP will be sitting in either $_POST['mylist'] or $_GET['mylist'], depending on how you’re submitting it.
Then I think you’ll need to use some Javascript to capture when the <select> is chosen, and store the three columns in the value of each <option>. The Javascript can extract the values and put them in the appropriate location on the page.
From the look of that, you’ve ‘borrowed’ some code from elsewhere for a multselect box.
Won’t break anything, but it’s a sign.
This would be my suggestion at this stage;
Have the PHP generate (echo out) a javascript object, such that the property keys are the option values from the select box, and the property values are the strings you want to appear in the textarea.
Alter the return of your res function to return the property of the object that was selected by the select box.