Aswathy S Aswathy S - 6 months ago 31
PHP Question

Pass data in redirect() - Typo3

I have a form after validation if any error occur the page will redirected to the edit itself with an error message.How to pass previous data and an error message through redirect() in typo3 ?

$this->redirect($action_name,$controllername, $extensionName, array('data',$data));

Is it right?

my action name is
But it is redirect to
.Please help me to solve this issue.


The arguments to pass to the redirect-target have to be given as associative array. The key is the argument name (as in the actions method header, without the $), the value is the argument value. Looks like this:

        'data' => $data

How exactly $data is encoded in the URL depends on its type. Persistent objects are encoded as their ID, scalars are encoded as simple strings. How they arrive in the other action depends on that actions typehints and @param annotations.

To redirect to the same controller or extension, you can set those two values to null.