How to save data from a form in Craft? Explain with an example?
You'd do this wiht a Craft plugin or module.

Try giving the plugin docs a once over: https://docs.craftcms.com/v3/extend and if you have some specific questions, feel free to post back.

You can also generate Craft plugin boilerplate code at https://pluginfactory.io that already has a lot of this setup for you.