简体   繁体   English

如何发布和从两个表中的值是在yii框架中?

[英]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). 我叫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) "" 输出显示类似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);

Check next: 下一步检查:

  1. var_dump($_POST['Ingredienttype']) 后续代码var_dump($ _ POST [ 'Ingredienttype'])
  2. ingredient_type is safe attribute 主成分类型是安全属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM