【问题标题】:How can I populate more than one zendform?如何填充多个 zendform?
【发布时间】:2014-05-31 15:35:28
【问题描述】:

我对许多 zend 形式的数量感到困惑。让我解释一下:我需要同时修改更多用户,并且我想在视图中为我预先选择的每个用户显示一个填充表单(要修改旧数据)。 我的控制器中有这段代码:

$list = $this->getRequest()->getParam('utenti');
$users=$this->_adminModel->getUsersByName($list);
$data=array();
foreach ($users as $user) {
$i=0;
$data[$i]=array(
'nome'=>$user->nome, 
'cognome'=>$user->cognome,
'email'=>$user->email,
'genere'=>$user->genere,
'nascita'=>$user->nascita,
'username'=>$user->username,
'passwd'=>$user->passwd,
'ripasswd'=>$user->passwd,
'impiego'=>$user->impiego,
'fumatore'=>$user->fumatore,
'telefono'=>$user->telefono,
'role'=>$user->role);
$i++;
$this->view->data= $data;}

在视图中,我有:

<? foreach($this->data ad $data){
echo $this->myform->populate($data);
}?>

我的错误是: 警告:为 myview.phtml 中的 foreach 提供的参数无效。 我哪里错了??

【问题讨论】:

    标签: forms zend-framework foreach populate


    【解决方案1】:

    尝试在你的 foreach 中将 ad 替换为 as

    【讨论】:

      猜你喜欢
      • 2019-01-22
      • 2011-02-21
      • 1970-01-01
      • 2012-07-05
      • 2020-11-03
      • 2012-06-29
      • 1970-01-01
      • 2022-06-15
      • 1970-01-01
      相关资源
      最近更新 更多