Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php adding options from an array

var example_array = {
    ValueA : 'Text A',
    ValueB : 'Text B',
    ValueC : 'Text C'
};

var select = document.getElementById("example-select");
for(index in example_array) {
    select.options[select.options.length] = new Option(example_array[index], index);
}
Source by electrictoolbox.com #
 
PREVIOUS NEXT
Tagged: #php #adding #options #array
ADD COMMENT
Topic
Name
9+4 =