I have a form with a custom button ,i want to add the field data to an database when clicking the custom button

You will need a function to process the data submitted by the form. You can use admin_post_ hook to process the data. This hook allows you to create custom handlers for your own custom GET and POST requests.

To save the data into the database, you can create a new table or Post Meta. Before jumping to the new table, consider storing your data in WordPress ‘Post Meta’.