I have created a table using a Controller and Model and in that file show some data.
But i don't know how to save that data in database i have created a table in Magento 2 db. But don't understand how to get those data and save it.
Any help is appriciated.
When i click on send it reload the page and in network it goes to 302 Found.
-
Please share some more details like the table name what are the fields and the code snippets where it would be easy to understand your problem and clear it soon.Rising– Rising2020年08月25日 06:04:39 +00:00Commented Aug 25, 2020 at 6:04
-
I have updated my question hope it helps will you please suggest me anything @RisingPrits– Prits2020年08月25日 06:07:16 +00:00Commented Aug 25, 2020 at 6:07
-
try this link magento.stackexchange.com/a/310465/82670Msquare– Msquare2020年08月25日 06:12:02 +00:00Commented Aug 25, 2020 at 6:12
-
here i added sample module you can check it. i hope this helps you. magento.stackexchange.com/a/317429/82670Msquare– Msquare2020年08月25日 06:13:54 +00:00Commented Aug 25, 2020 at 6:13
-
I am not using Admin Grid for my module is it necessary to use it i have just a simple form in that a table to show the data @MsquarePrits– Prits2020年08月25日 06:15:08 +00:00Commented Aug 25, 2020 at 6:15
1 Answer 1
the method you are using is incorrect. Magento 2 provides the UI components for your needs. Here are some examples on how to implement a custom table backend grid and how to save it.
docs: https://devdocs.magento.com/guides/v2.4/ui_comp_guide/howto/new_component_declaration.html
example:
https://webkul.com/blog/create-collection-grid-editadd-grid-row-installer-magento2/
Cheers