Sending data from flutter app to server is very important feature for every android/ios application. That makes our application dynamic. This tutorial is helpful for beginners who wish to understand dynamic content management in flutter . In this tutorial i am going to do some basic programming and learn how to insert data from application to MySQL database using flutter and PHP .
1.Create a new flutter project in vscode or android studio using flutter create appname
- Creating a database on your phpmyadmin : Database is very important because without database there is no possible way to creating tables. Now make an database on your PHPMYADMIN 3.Create a table in your database : Create a table in your database named as registereduser and create four columns id, name, mobile,email into that table .
- Now Upload your PHP script on your server : After finishing table creation process just upload the below two PHP scripts on your server using file manager. There are two different type of files present here first one is config.php file and second is insertdata.php file. Please change the details of your server in config.php file.
- Check your PHP script : After done uploading procedure just open the insertdata.php file URL in your web browser and you can see that its showing us the user added Successfully message and when you open the PhpMyAdmin control panel there is a blank value inserted in your table. This value is blank because there is no such data present for insertion. 6.Now it’s time to write code in flutter After done all the back-end procedure now it’s time to write some code for flutter.so in this app simply we create three textfield named as a name,email & mobile. 7.Now we will create a function for sending data into mysql
8.Complete Code of main.dart file
Go through this link