Saving form input

Hello.

I am a total newbie to web development and kirby and I am currently trying to build a site for a school friends association.

There is going to be a form where people can enter their name, email and how much money they want to provide to the school per year and if they up for the emailnewsletter.
I want to save the entries somehow.

What would be best practice to do that ?
I managed to save the data to a csv, but I am wondering if there is a better, safer and more elegant way?

Thanks for any suggestions,
Oliver

Hey @OPopp,
when I get you right you just want to know a better/safer/more elegant way to store the data provided by your form?

It really depends on what you want to do with the stored data. If you just want to save it - CSV is fine I guess.

If you want to work with the data later on I would think about storing the data in a json-file and give every data an id of e.g. a timestamp. So you can easy work with it in each language (js, php) and you dont have to create arrays from csv files later or so.

1 Like

Hey @habundloot,
thanks a lot for the input. I really appreciate it!
Not yet shure what I am going to do with the data, but I will figure out soon.
Thanks and Cheers,

If you expect a lot of data, I’d go for subpages or an SQLite database instead of saving into a single file.

1 Like

@texnixe Great thanks for the input. I will consider it and good to know the next better solution. Thanks!

@OPopp I’m trying to do build the same myself,

Would you mind sharing the code you used for storing the entries in a csv?

Hey @aengustukel !

I actually never managed to solve it properly.
In the end I saved the data/users as subpages (to be able to view them in the panel) and also saved the data to a json file.

Maybe check this plugin out - Not shure if it does what you need.

Other than that: Chat GPT helped me a lot :smiley:

Good Luck!

Just to save some time: my CSV field plugin won’t help here. It’s really just there for previewing an existing CSV file in the Panel, with a helper to do the output also in templates. But no editing or writing to the CSV.

1 Like