Most frameworks provide a way to generate forms. The keyword here is "frameworks". If you happen to work in a project that does not depend on one a framework that provides Form generation and you do not want to add a framework dependency, then you are in a problem. You either have a very tedious task ahead or you can use Dora, https://github.com/gajus/dora.
Dora allows to generate inputs, populate them with data, wrap them in your own templates (presenters?), integrate them with your input validation (or you can use https://github.com/gajus/vlad), protect from XSS and CSRF vulnerabilities.
If it sounds great, then check out the demo (http://gajus.com/dora/demo/) and head to the documentation https://github.com/gajus/dora. Then help author to spread the word either with your own creative tweet or a re-tweet, https://twitter.com/kuizinas/status/460044916799070208.