Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <?php $form = ActiveForm::begin(); ?>
  2.  
  3. <?= $form->field($model, 'name')->label('Имя') ?>
  4.  
  5. <?= $form->field($model, 'category')->label('Категория') ?>
  6.  
  7. <?= Html::submitButton('Отправить', ['class' => 'btn btn-primary']) ?>
  8.  
  9. <?php ActiveForm::end(); ?>
  10.  
  11. namespace appmodels;
  12.  
  13. use yiidbActiveRecord;
  14.  
  15. class Products extends ActiveRecord
  16. {
  17.  
  18. public $name;
  19. public $category;
  20.  
  21.  
  22. public static function tableName()
  23. {
  24. return 'products';
  25. }
  26.  
  27. }
  28.  
  29. $model = new Products();
  30. if ($model->load(Yii::$app->request->post()))
  31. $model->save();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement