Link to home
Start Free TrialLog in
Avatar of MarkJulie
MarkJulieFlag for United States of America

asked on

Convert csv list to html dropdown in php form

I have a list of spoken languages in a csv file that I need to quickly put into a WordPress php form. It should display as a drop down list. If it is an easier task from xlxx or tab separated values, I can convert them.

Mark
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Can you give us an example of data, please?
SOLUTION
Avatar of rinfo
rinfo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No need to reinvent the wheel: you can simply use native fgetcsv() function to read the csv file into an array.
Agree with Marco... Please post the CSV file here in the code snippet or post a link to the CSV file so we can see the actual format of the data, how many lines, how many positions per line, etc.  If you show us the data you may be able to get a tested-and-working code example.
Avatar of MarkJulie

ASKER

Sorry. I thought I had attached at original posting. Also, the WP form plugin wants html syntax, not php (though it displays in a .php page.
Languages.csv
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Interesting... The CSV file posted with this question does not have any line endings or commas.  Is that an exact copy of the file you're using?  If not, and you want to post the URL of the file I'll be glad to try to use the original.
Avatar of rinfo
rinfo

Though i could not understand what he meant but author has indicated this

the WP form plugin wants html syntax, not php (though it displays in a .php page.

frankly i am quite confuse , some option are reading csv file using html5 but then again java script would be needed to populate options.
besides is there any wordpress plugin that would need just html.
Thanks for the general and specific solutions despite a less than ideal file.