<p>I would suggest either using query parameters in your redirect method, or storing it in session variables (which should be no different than regular PHP).</p>

CC BY-SA 3.0
2014-07-18T14:33:55.053Z
Hoped to avoid that, but thanks :)
Victor
CC BY-SA 3.0
2014-07-17T17:40:10.720Z
2014-07-17T17:40:10.720Z
Bryan Redeagle
<p>I have a <a href="http://buildwithcraft.com/docs/plugins/controllers#posting-to-controller-actions" rel="nofollow">Controller Action</a> which should pass on some data from one (CP) template to another:</p>

<ol>
<li>Template 1 (<code>plugin/form</code>): Form sends data</li>
<li>Controller redirects data to Template 2</li>
<li>Template 2 (<code>plugin/</code>): Shows data</li>
</ol>

<p>I don't want to just load the template but redirect to <code>plugin/</code> and show the data, any ideas?</p>

<pre class="lang-php prettyprint-override"><code>public function actionTemplate()
{
    $data = 'Something';
    $this-&gt;redirect( 'plugin_handle' ); //Pass on $data to 'plugin/'
}
</code></pre>

<p><strong>Edit 1:</strong></p>

<p>Or is there a way to send a post-request to a "route" rather then an actionController?</p>

<plugin-development><controller>
How to perform a redirect and pass on data?
# How to perform a redirect and pass on data?

(Asked by: username_0 on 2014-07-17)

I have a Controller Action which should pass on some data from one (CP) template to another:

Template 1 (plugin/form): Form sends data
Controller redirects data to Template 2
Template 2 (plugin/): Shows data

I don't want to just load the template but redirect to plugin/ and show the data, any ideas?
public function actionTemplate()
{
    $data = 'Something';
    $this->redirect( 'plugin_handle' ); //Pass on $data to 'plugin/'
}

Edit 1:
Or is there a way to send a post-request to a "route" rather then an actionController?

**Tags:** plugin-development, controller

---

## 1 answers

### Answer by username_1 on 2014-07-17. Score: 2

I would suggest either using query parameters in your redirect method, or storing it in session variables (which should be no different than regular PHP).

> **Comments:**
> **username_0**: Hoped to avoid that, but thanks :)  

---

