Like many things, "best practices"-answers have their place and time. I feel that this is the wrong place for a "best practice" answer.
There is nothing wrong with keeping a list of countries in a plain text file depending on the circumstances. In this question, there is little context, and no reason to assume that keeping said list in a plain text file is "wrong". In fact, I personally see little advantage over JSON or XML here. And using a database table might be okay if you're already using a database, and even then it's not strictly "required".
Furthermore, you initially posted JavaScript-only answer on a PHP question. You may feel that doing it this with jQuery and AJAX is better, but that's obviously not what's asked here, and rendering this server-side is fine (in fact better I would say).
Imagine if everyone would do this:
- All JSON question would get a "No use XML"-answer.
- All XML question would get a "No use JSON "-answer.
- All Python questions would get a "No use Ruby"-anser.
- All Ruby questions would get a "No use Python "-anser.
- ...etc...
I'm not downvoting this as it already has two downvotes and because posts on meta tend to attract attention and excessive downvotes (the so-called meta effect), but if I had encountered it in the wild, I would have downvoted it as it doesn't really answer the asked question.
The best thing to do is usually:
- First answer the actual asked question.
- Then expand why you feel this is a bad idea, and offer a better solution.
For example a few days ago I posted an answer here which detailed why I felt that the asker was making a mistake in asking for this. But I also offered a possible solution which directly answered the question in case she disagrees and really wants to do this.