Send a Parameter between Actions

8 messages Options
Embed this post
Permalink
expertics

Send a Parameter between Actions

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Hi, I need send a parameter between Actions and  I haven't found the solution.

I have this code in the Controller:
 
class clientController extends Zend_Controller_Action
{
...
   public function  viewAction(){

   }
 
   public function processAction() {
 
      (a) ... Process...
 
      $result = array('id'=>566 , array('p1'=>'6667', 'p2'=>'6668', 'p3'=>'6667', ....);
    
  ===> I like to send an array ( $result as parameter) from here to check(), because I am going to use _redirect  . how i do this?
      $this->_redirect('client/check'); 

   }
 
 
   public function checkAction() {
 
      (*) show the output ( $result)
   }
 
 
In the View :
 
view.phtml  --> it has a form ( <form method="post" action="/client/procces"> )
 
 
Thanks
 
George
 
Abraham Block

Re: Send a Parameter between Actions

Reply Threaded More More options
Print post
Permalink
You can't send a parameter in, but you can save it in a session variable. If its just a message (and I guess technically  anything, you can use the flashmessenger action helper

On Wed, Dec 10, 2008 at 4:48 PM, Expertics <[hidden email]> wrote:
Hi, I need send a parameter between Actions and  I haven't found the solution.

I have this code in the Controller:
 
class clientController extends Zend_Controller_Action
{
...
   public function  viewAction(){

   }
 
   public function processAction() {
 
      (a) ... Process...
 
      $result = array('id'=>566 , array('p1'=>'6667', 'p2'=>'6668', 'p3'=>'6667', ....);
    
  ===> I like to send an array ( $result as parameter) from here to check(), because I am going to use _redirect  . how i do this?
      $this->_redirect('client/check'); 

   }
 
 
   public function checkAction() {
 
      (*) show the output ( $result)
   }
 
 
In the View :
 
view.phtml  --> it has a form ( <form method="post" action="/client/procces"> )
 
 
Thanks
 
George
 

Paul Shoemaker

Re: Send a Parameter between Actions

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
You can send a parameter in to an action if you use the actionstack controller plugin accessible via $this->_helper->actionstack(action, controller, module, array('key' => 'value')) where the array parameter at the end receives variable and assignments in key / value pair format.

This may or may not be helpful for you in your specific situation but just fyi.

Note:  the variable is then scoped into the controller object and is accessible via $this->key

Thanks!
--

Paul Shoemaker | LAMP Developer
[hidden email]

echo  |  Hello. Hello.  |  helloecho.com

The information contained in this message is intended only for the use
of the individual or entity named above. If the reader of this message
is not the intended recipient, or the employee or agent responsible for
delivering it to the intended recipient, you are hereby notified that
any dissemination, distribution, or copying of this communication is
strictly prohibited.

Please consider the environment and do not print this email unless necessary.

On Dec 10, 2008, at 4:33 PM, Abraham Block wrote:

You can't send a parameter in, but you can save it in a session variable. If its just a message (and I guess technically  anything, you can use the flashmessenger action helper

On Wed, Dec 10, 2008 at 4:48 PM, Expertics <[hidden email]> wrote:
Hi, I need send a parameter between Actions and  I haven't found the solution.

I have this code in the Controller:
 
class clientController extends Zend_Controller_Action
{
...
   public function  viewAction(){

   }
 
   public function processAction() {
 
      (a) ... Process...
 
      $result = array('id'=>566 , array('p1'=>'6667', 'p2'=>'6668', 'p3'=>'6667', ....);
    
  ===> I like to send an array ( $result as parameter) from here to check(), because I am going to use _redirect  . how i do this?
      $this->_redirect('client/check'); 

   }
 
 
   public function checkAction() {
 
      (*) show the output ( $result)
   }
 
 
In the View :
 
view.phtml  --> it has a form ( <form method="post" action="/client/procces"> )
 
 
Thanks
 
George
 


Abraham Block

Re: Send a Parameter between Actions

Reply Threaded More More options
Print post
Permalink
Paul,
He can't use the action stack since he's doing a redirect.

On Wed, Dec 10, 2008 at 5:39 PM, Paul Shoemaker <[hidden email]> wrote:
You can send a parameter in to an action if you use the actionstack controller plugin accessible via $this->_helper->actionstack(action, controller, module, array('key' => 'value')) where the array parameter at the end receives variable and assignments in key / value pair format.

This may or may not be helpful for you in your specific situation but just fyi.

Note:  the variable is then scoped into the controller object and is accessible via $this->key

Thanks!
--

Paul Shoemaker | LAMP Developer
[hidden email]

echo  |  Hello. Hello.  |  helloecho.com

The information contained in this message is intended only for the use
of the individual or entity named above. If the reader of this message
is not the intended recipient, or the employee or agent responsible for
delivering it to the intended recipient, you are hereby notified that
any dissemination, distribution, or copying of this communication is
strictly prohibited.

Please consider the environment and do not print this email unless necessary.

On Dec 10, 2008, at 4:33 PM, Abraham Block wrote:

You can't send a parameter in, but you can save it in a session variable. If its just a message (and I guess technically  anything, you can use the flashmessenger action helper

On Wed, Dec 10, 2008 at 4:48 PM, Expertics <[hidden email]> wrote:
Hi, I need send a parameter between Actions and  I haven't found the solution.

I have this code in the Controller:
 
class clientController extends Zend_Controller_Action
{
...
   public function  viewAction(){

   }
 
   public function processAction() {
 
      (a) ... Process...
 
      $result = array('id'=>566 , array('p1'=>'6667', 'p2'=>'6668', 'p3'=>'6667', ....);
    
  ===> I like to send an array ( $result as parameter) from here to check(), because I am going to use _redirect  . how i do this?
      $this->_redirect('client/check'); 

   }
 
 
   public function checkAction() {
 
      (*) show the output ( $result)
   }
 
 
In the View :
 
view.phtml  --> it has a form ( <form method="post" action="/client/procces"> )
 
 
Thanks
 
George
 



Hector Virgen

Re: Send a Parameter between Actions

Reply Threaded More More options
Print post
Permalink
If you need to persist data between requests, why not use the session?

-Hector


On Wed, Dec 10, 2008 at 2:41 PM, Abraham Block <[hidden email]> wrote:
Paul,
He can't use the action stack since he's doing a redirect.


On Wed, Dec 10, 2008 at 5:39 PM, Paul Shoemaker <[hidden email]> wrote:
You can send a parameter in to an action if you use the actionstack controller plugin accessible via $this->_helper->actionstack(action, controller, module, array('key' => 'value')) where the array parameter at the end receives variable and assignments in key / value pair format.

This may or may not be helpful for you in your specific situation but just fyi.

Note:  the variable is then scoped into the controller object and is accessible via $this->key

Thanks!
--

Paul Shoemaker | LAMP Developer
[hidden email]

echo  |  Hello. Hello.  |  helloecho.com

The information contained in this message is intended only for the use
of the individual or entity named above. If the reader of this message
is not the intended recipient, or the employee or agent responsible for
delivering it to the intended recipient, you are hereby notified that
any dissemination, distribution, or copying of this communication is
strictly prohibited.

Please consider the environment and do not print this email unless necessary.

On Dec 10, 2008, at 4:33 PM, Abraham Block wrote:

You can't send a parameter in, but you can save it in a session variable. If its just a message (and I guess technically  anything, you can use the flashmessenger action helper

On Wed, Dec 10, 2008 at 4:48 PM, Expertics <[hidden email]> wrote:
Hi, I need send a parameter between Actions and  I haven't found the solution.

I have this code in the Controller:
 
class clientController extends Zend_Controller_Action
{
...
   public function  viewAction(){

   }
 
   public function processAction() {
 
      (a) ... Process...
 
      $result = array('id'=>566 , array('p1'=>'6667', 'p2'=>'6668', 'p3'=>'6667', ....);
    
  ===> I like to send an array ( $result as parameter) from here to check(), because I am going to use _redirect  . how i do this?
      $this->_redirect('client/check'); 

   }
 
 
   public function checkAction() {
 
      (*) show the output ( $result)
   }
 
 
In the View :
 
view.phtml  --> it has a form ( <form method="post" action="/client/procces"> )
 
 
Thanks
 
George
 




expertics

Re: Send a Parameter between Actions

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I think it is a good idea...Thanks
----- Original Message -----
Sent: Wednesday, December 10, 2008 6:10 PM
Subject: Re: [fw-mvc] Send a Parameter between Actions

If you need to persist data between requests, why not use the session?

-Hector


On Wed, Dec 10, 2008 at 2:41 PM, Abraham Block <[hidden email]> wrote:
Paul,
He can't use the action stack since he's doing a redirect.


On Wed, Dec 10, 2008 at 5:39 PM, Paul Shoemaker <[hidden email]> wrote:
You can send a parameter in to an action if you use the actionstack controller plugin accessible via $this->_helper->actionstack(action, controller, module, array('key' => 'value')) where the array parameter at the end receives variable and assignments in key / value pair format.

This may or may not be helpful for you in your specific situation but just fyi.

Note:  the variable is then scoped into the controller object and is accessible via $this->key

Thanks!
--

Paul Shoemaker | LAMP Developer
[hidden email]

echo  |  Hello. Hello.  |  helloecho.com

The information contained in this message is intended only for the use
of the individual or entity named above. If the reader of this message
is not the intended recipient, or the employee or agent responsible for
delivering it to the intended recipient, you are hereby notified that
any dissemination, distribution, or copying of this communication is
strictly prohibited.

Please consider the environment and do not print this email unless necessary.

On Dec 10, 2008, at 4:33 PM, Abraham Block wrote:

You can't send a parameter in, but you can save it in a session variable. If its just a message (and I guess technically  anything, you can use the flashmessenger action helper

On Wed, Dec 10, 2008 at 4:48 PM, Expertics <[hidden email]> wrote:
Hi, I need send a parameter between Actions and  I haven't found the solution.

I have this code in the Controller:
 
class clientController extends Zend_Controller_Action
{
...
   public function  viewAction(){

   }
 
   public function processAction() {
 
      (a) ... Process...
 
      $result = array('id'=>566 , array('p1'=>'6667', 'p2'=>'6668', 'p3'=>'6667', ....);
    
  ===> I like to send an array ( $result as parameter) from here to check(), because I am going to use _redirect  . how i do this?
      $this->_redirect('client/check'); 

   }
 
 
   public function checkAction() {
 
      (*) show the output ( $result)
   }
 
 
In the View :
 
view.phtml  --> it has a form ( <form method="post" action="/client/procces"> )
 
 
Thanks
 
George
 




joostvanveen

Re: Send a Parameter between Actions

Reply Threaded More More options
Print post
Permalink
If
-there's not too many items in your array and
-you don't want the overhead of using sessions

you may consider imploding the array to a string, like 12#456#123#90. You can then fetch it from the URI in your second controller and turn it into an array again using explode()

expertics wrote:
I think it is a good idea...Thanks
  ----- Original Message -----
  From: Hector Virgen
  To: Abraham Block
  Cc: Paul Shoemaker ; Expertics ; fw-mvc@lists.zend.com
  Sent: Wednesday, December 10, 2008 6:10 PM
  Subject: Re: [fw-mvc] Send a Parameter between Actions


  If you need to persist data between requests, why not use the session?

  -Hector



  On Wed, Dec 10, 2008 at 2:41 PM, Abraham Block <atblock@gmail.com> wrote:

    Paul,
    He can't use the action stack since he's doing a redirect.



    On Wed, Dec 10, 2008 at 5:39 PM, Paul Shoemaker <paul.shoemaker@helloecho.com> wrote:

      You can send a parameter in to an action if you use the actionstack controller plugin accessible via $this->_helper->actionstack(action, controller, module, array('key' => 'value')) where the array parameter at the end receives variable and assignments in key / value pair format.


      This may or may not be helpful for you in your specific situation but just fyi.


      Note:  the variable is then scoped into the controller object and is accessible via $this->key


      Thanks!

      --


      Paul Shoemaker | LAMP Developer
      paul.shoemaker@helloecho.com

      echo  |  Hello. Hello.  |  helloecho.com

      The information contained in this message is intended only for the use
      of the individual or entity named above. If the reader of this message
      is not the intended recipient, or the employee or agent responsible for
      delivering it to the intended recipient, you are hereby notified that
      any dissemination, distribution, or copying of this communication is
      strictly prohibited.


      Please consider the environment and do not print this email unless necessary.


      On Dec 10, 2008, at 4:33 PM, Abraham Block wrote:


        You can't send a parameter in, but you can save it in a session variable. If its just a message (and I guess technically  anything, you can use the flashmessenger action helper


        On Wed, Dec 10, 2008 at 4:48 PM, Expertics <expertics@gmail.com> wrote:

          Hi, I need send a parameter between Actions and  I haven't found the solution.

          I have this code in the Controller:

          class clientController extends Zend_Controller_Action
          {
          ...
             public function  viewAction(){

             }

             public function processAction() {

                (a) ... Process...

                $result = array('id'=>566 , array('p1'=>'6667', 'p2'=>'6668', 'p3'=>'6667', ....);
               
            ===> I like to send an array ( $result as parameter) from here to check(), because I am going to use _redirect  . how i do this?
                $this->_redirect('client/check');

             }


             public function checkAction() {
           
                (*) show the output ( $result)
             }


          In the View :

          view.phtml  --> it has a form ( <form method="post" action="/client/procces"> )


          Thanks

          George
           







A.J. Brown

Re: Send a Parameter between Actions

Reply Threaded More More options
Print post
Permalink
In reply to this post by expertics
If it's not something that the user should be able to submit themselves, it's not a good practice to pass data to your application through POST or GET parameters.  

Your options are to use the SESSION directly, use COOKIES (not reliable) or to have some other mechanism that persist data for sessions.  

--
A.J. Brown
Zend Certified PHP Engineer
http://ajbrown.org



----- Original Message -----

If
-there's not too many items in your array and
-you don't want the overhead of using sessions

you may consider imploding the array to a string, like 12#456#123#90. You
can then fetch it from the URI in your second controller and turn it into an
array again using explode()


expertics wrote:

>
> I think it is a good idea...Thanks
>   ----- Original Message -----
>   From: Hector Virgen
>   To: Abraham Block
>   Cc: Paul Shoemaker ; Expertics ; [hidden email]
>   Sent: Wednesday, December 10, 2008 6:10 PM
>   Subject: Re: [fw-mvc] Send a Parameter between Actions
>
>
>   If you need to persist data between requests, why not use the session?
>
>   -Hector
>
>
>
>   On Wed, Dec 10, 2008 at 2:41 PM, Abraham Block <[hidden email]>
> wrote:
>
>     Paul,
>     He can't use the action stack since he's doing a redirect.
>
>
>
>     On Wed, Dec 10, 2008 at 5:39 PM, Paul Shoemaker
> <[hidden email]> wrote:
>
>       You can send a parameter in to an action if you use the actionstack
> controller plugin accessible via $this->_helper->actionstack(action,
> controller, module, array('key' => 'value')) where the array parameter at
> the end receives variable and assignments in key / value pair format.
>
>
>       This may or may not be helpful for you in your specific situation
> but just fyi.
>
>
>       Note:  the variable is then scoped into the controller object and is
> accessible via $this->key
>
>
>       Thanks!
>
>       --
>
>
>       Paul Shoemaker | LAMP Developer
>       [hidden email]
>
>       echo  |  Hello. Hello.  |  helloecho.com
>
>       The information contained in this message is intended only for the
> use
>       of the individual or entity named above. If the reader of this
> message
>       is not the intended recipient, or the employee or agent responsible
> for
>       delivering it to the intended recipient, you are hereby notified
> that
>       any dissemination, distribution, or copying of this communication is
>       strictly prohibited.
>
>
>       Please consider the environment and do not print this email unless
> necessary.
>
>
>       On Dec 10, 2008, at 4:33 PM, Abraham Block wrote:
>
>
>         You can't send a parameter in, but you can save it in a session
> variable. If its just a message (and I guess technically  anything, you
> can use the flashmessenger action helper
>
>
>         On Wed, Dec 10, 2008 at 4:48 PM, Expertics <[hidden email]>
> wrote:
>
>           Hi, I need send a parameter between Actions and  I haven't found
> the solution.
>
>           I have this code in the Controller:
>
>           class clientController extends Zend_Controller_Action
>           {
>           ...
>              public function  viewAction(){
>
>              }
>
>              public function processAction() {
>
>                 (a) ... Process...
>
>                 $result = array('id'=>566 , array('p1'=>'6667',
> 'p2'=>'6668', 'p3'=>'6667', ....);
>                
>             ===> I like to send an array ( $result as parameter) from here
> to check(), because I am going to use _redirect  . how i do this?
>                 $this->_redirect('client/check');
>
>              }
>
>
>              public function checkAction() {
>            
>                 (*) show the output ( $result)
>              }
>
>
>           In the View :
>
>           view.phtml  --> it has a form ( <form method="post"
> action="/client/procces"> )
>
>
>           Thanks
>
>           George
>            
>
>
>
>
>
>
>
>
>
>

--
View this message in context:
http://www.nabble.com/Send-a--Parameter-between-Actions-tp20944853p20951152.html

Sent from the Zend MVC mailing list archive at Nabble.com.