Create (Insert) RecordTo insert the records in the database, following steps are there. We have named our Yii2 folder as create. Step 1 Create Model file Create a model file child.php in frontend/models folder. Look at the above code,
Step 2 Create Controllers file Create a controller file ChildController.php in frontend/controllers folder. Step 3 Create View file Create a view folder child in frontend/views folder. Then create a file create.php in frontend/views/child folder. Now create a file child_view.php in frontend/views/child folder. Step 4 Run it Now run your application on your browser with the following URL. http://localhost/create/frontend/web/index.php?r=child/create Look at the above snpashot, after filling all the fields click on Create button and your data will be inserted into the database. You can check it in the database from your phpmyadmin. Next TopicRead Record |