user3519015
user3519015

Reputation:

how to post and get the values from two table is in yii framework?

i Post values from single and get from table it is working fine. if post from two table and get from two table is not showing second table data. i called var_dump($aaa). but it showing string "",

i show here my controller code here. please suggest how cloud be change :

i did like this. output showing like string(0) ""

 $model=new Recipe;   $model1= new Ingredienttype;
if(isset($_POST['Recipe']))
{
$model->attributes=$_POST['Recipe'];
 $recipe_name=$model->name;
 $course=$model->course_id;
$cuisine=$model->cuisinename;
 $type=$model->type;
 $calorie=$model->calorie_count;
 if(isset($_POST['Ingredienttype']))
$model1->attributes=$_POST['Ingredienttype'];
$ingredient=$model1->ingredient_type;
 var_dump($ingredient);
{

$this->redirect(array('advancesearch1','name'=>$recipe_name,
    'course'=>$course,'cuisine'=>$cuisine,'ingredient'=>$ingredient,
         'type'=>$type,'calorie'=>$calorie
        ));
    }

}

  $this->render('newadv',array('model'=>$model,'model1'=>$model1));

}

public function actionAdvancesearch1()
    {
       $model=new Recipe;

       $name=$_GET['name'];
       $course1=$_GET['course'];
       $cuisine1=$_GET['cuisine'];
       $type1=$_GET['type'];
       $calorie1=$_GET['calorie'];
       $ingredient1=$_GET['ingredient'];
       var_dump($ingredient1);

Upvotes: 0

Views: 54

Answers (1)

Alex
Alex

Reputation: 8072

Check next:

  1. var_dump($_POST['Ingredienttype'])
  2. ingredient_type is safe attribute

Upvotes: 1

Related Questions