Tuesday, February 15, 2022

[FIXED] How do I add new form page to take information from user and store in database in Yii?

Issue

The website is already live and I have to add a new form , The previous Developer had created the website in Yii v1 and I have little knowledge about Yii2 .

Can I do it manually or I need to do it with Gii only ,If yes then How ?

How should I run the entire app on local host ?


Solution

I think You are beginner in yii. i'll explain you clearly.

Basic Initial steps :

  • 1.First Install yii v1 in your local host.

  • 2.copy live website codes and paste it in your server folder.

  • 3.copy the live database structure and create in your (localhost/phpmyadmin)

  • 4.change database name in config.php file.

Your Requirement steps:

  • first u try to understand your website old codes.
  • Don't try to write yii2 codes in your website.
  • create new table in database to store data
  • open gii in localhost using url like(localhost/foldername/index.php?r=gii)
  • generate Model using that new table

  • generate CURD using your new Model.

  • now you done new form insert update delete function.

  • U can get user details by Yii::app()->user->getId();

I think now u got idea to get all details from users and stored in database in your local server.



Answered By - Prabhakaran

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.