There is nothing wrong with using a file to store data ("flat file" storage) as long as you know it's pitfalls, one of which is the lack of protection when written to by different threads (that is, PHP processes may read and write to the file at the same time, and this can cause contention issues). If this is not an issue, flat file storage might be a good option, but trq is suggesting a database because they excel at preventing this type of issue (see ACID compliance). Not all databases are ACID compliant, so when you pick one, make sure it supports concurrency control (such as MySQL, PostreSQL, etc).
That method of inserting text in HTML is fine, too, as long as you are aware of when that pattern falls. It's actually a better system than directly printing variables in the HTML (because a tight coupling of logic and design means neither can flexibly change) but there are better alternatives still. A templating system such as Mustache or Smarty provide this support, as well as iterative loops, basic post-variable "rendering" options, etc.
In this case, I'd suggest reading up on MySQL and PDO.