By runeveryday on
i am a newbie of write a new module. when write a form, i always don't know what code i should write when write the form's submit(function mymodule_form_submit($form, &$form_state){ }
). any tips would be appreciated.
i am a newbie of write a new module. when write a form, i always don't know what code i should write when write the form's submit(function mymodule_form_submit($form, &$form_state){ }
). any tips would be appreciated.
Comments
It's hard to answer that, as
It's hard to answer that, as the question is quite vague. But basically, a form takes input from the user. In the submit function, you take that input, and do something with it. If you need to save it to the database, you save it to the database. If you need to send an email, send an email. If you need to redirect the user, redirect the user. If you need to display the data to the screen, display the data to the screen. And so on.
Contact me to contract me for D7 -> D10/11 migrations.
The Form API Quickstart Guide
The Form API Quickstart Guide should be helpful.