Form Not working in YII2

I am new to yii framework.

I have created a from like this. When i try to view the form in the browser like this http://localhost/basic/web/index.php?r=site/user i see a blank white page.

I checked the apache log, No errors logged.



    namespace appmodels;
    use Yii;
    use yiibaseModel;

    class UserForm extends Model
        public $name;
        public $email;

        public function rules()
            return [

                [['name', 'email'], 'required'],

                ['email', 'email'],




 public function actionUser(){

    $model = new UserForm;

    if ($model->load(yii::$app->request->post()) && $model->validate()) {
        echo "string";
        # code...
        $this->render('userForm', ['model'=> $model]);



    use yiihelpersHtml;
    use yiiwidgetsActiveForm;


    <?php $form = ActiveForm::begin(); ?>
    <?= $form->field($model, 'name'); ?>
    <?= $form->field($model, 'email'); ?>

    <?= Html::submitButton('submit', ['class'=>'btn btn-success']); ?>

Can some one help me to fix this problem. Tnx.

Source: php

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.