douqiu0796 2012-08-11 11:17
浏览 16
已采纳

在cakephp中的表单重定向之后打印输入元素的值

i am very much new to cakephp. I have created a simple form with input controls on it as follows:

  <?php
    echo $this->Form->create();
    echo $this->Form->input('name');
    echo $this->Form->input('address', array('rows' => '3'));
    echo $this->Form->input('aaa', array(
        'type'      => 'date',
        'label'     => 'select',
        'before'    => '--before--',
        'after'     => '--after--',
        'between'   => 'Date',
        'separator' => '****',
        'empty'     => '--select--'
    ));
    echo $this->Form->checkbox('subjects', array('value' => 'Java'));
?>
java
<?php
    echo $this->Form->input('gen', array(
        'type' => 'radio',
        'options' => array('m', 'f')
    ));
    echo $this->Form->input('file', array('type' => 'file'));
    echo $this->Form->input('listbox', array('options' => array(1,2,3,4,5), 'multiple' => 'multiple'));
    echo $this->Form->end('Submit');
?>

i wish to print the values entered in these components on another page. how do i do that? i tried to do it with the help of session(which seems to be inappropriate) as follows:

public function contactus() {
        if ($this->request->data!=null) {
            $var=$this->request->data;
            $this -> Session -> write('myvar', $this->request->data);
            //$this->set($var, $this->request->data);
            $this->redirect(array('action' => 'contactview'));
        }
    }

but it outputs array and i cant use session to store each component's value. how do i solve this?

  • 写回答

2条回答 默认 最新

  • douan3019 2012-08-12 11:45
    关注

    Rather than using the session, I used this->data and it was able to resolve my problem.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀