Skip to content
Advertisement

Form returned bad request: Missing required parameters: id

I’m new to yii2 and I want to make a signup form using yii2 basic I use the generated mvc from gii but when i submit the registration it returned bad request but some of the data i’ve input is in the database but some are missing too. Here is my user model:

JavaScript

And my actionCreate in user controller

JavaScript

the view

JavaScript

I can’t find where my code is wrong Please help me

Advertisement

Answer

save(false) method does not validate your data!
That’s why some data may not be included in the database.

Consider the following:

1- The data of your rules() method must match the database.(rules() In model file)

2- Use the following in action:

JavaScript

Or:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement