Save data from the html form to a file

I am writing a project for the university. You need to save data from the html form to a file, add data to this file, and then return it. What is the best way to do it? Or how to make it easier? Using PHP or JS?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum