/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new KeywordSubcategory(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['KeywordSubcategory'])) { $model->attributes = $_POST['KeywordSubcategory']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
<?php $model = new KeywordSubcategory(); if (isset($_POST['KeywordSubcategory'])) { $model->attributes = $_POST['KeywordSubcategory']; $model->save(); $this->refresh(); } ?> <div class="form"> <?php $form = $this->beginWidget('CActiveForm'); ?> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo "Create new subcategory : "; ?> <?php echo $form->textField($model, 'name', array('size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'name'); ?> </div>