Then you are doing something wrong.
Your redirect array should be:
$this->redirect(
'controller' => 'motor_developments',
'action'=>'view',
$student_id
);
Notice that you have MotorDevelopments - which ought not to work at all.
So long as $student_id has a value in the controller that is doing the
redirecting, it will appear as a valid parameter in
motor_developments_controller. I presume that your view function looks like
this:
function view ($student_id) {}
...in which case $student_id will be equal to the value you sent.
Jeremy Burns
Class Outfit
http://www.classoutfit.com
On 21 Nov 2011, at 00:18, varai wrote:
> Yes, you are right, when I just pass Student.id to the view, it is
> working fine. However, I couldn't pass Student.id through redirect as
> in
> $this->redirect('controller'=>'MotorDevelopments','action'=>'view',
> $student_id)
> because it is giving the undefined variable error.
>
> So, i did that through session and it is working fine. As suggested
> in :
> http://stackoverflow.com/questions/4427829/cakephp-passing-data-to-view-after-redirect
>
> Now i'm able to access $student_id in the view.
>
> Thanks a lot.
>
> On Nov 17, 3:32 pm, phpMagpie <[email protected]> wrote:
>> Jeremy is right, redirect sends a new request to the url you specified i.e.
>> /motor_developments/search/$studentInfo and as $studentInfo is an array you
>> cannot do this.
>>
>> How about just passing the Student.id and doing the Student->find() in the
>> redirected controller?
>>
>> HTH, Paul.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php