MarkJulie
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
Mark
Can you give us an example of data, please?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
Languages.csv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
Though i could not understand what he meant but author has indicated this
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.
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.
ASKER
Thanks for the general and specific solutions despite a less than ideal file.