Note that the "Saisies" plugin can be used to write the form’s fields using a #SAISIE tag, and specifying the type and name of the variable used, followed by whichever optional parameters are useful. Doing so would produce (the code section between <ul> and </ul>):

Loading, verifying and processing

The formulaires/calculate_doy.php file contains the three following functions:

The "loading" file lists the variables which will be passed into the template environment and initialises their default values. There is no default date here, but it would be possible to specify one if you wanted.

If the verifications are correct (no errors found), then the "process" function is executed. The form is declared as re-editable, which means that a new date value can be entered again immediately after the validation.

Of course, this still omits the function used to calculate the day-of-the-year, but a few simple lines of PHP will fix that. This function can be implemented in the same file as the three previous functions: