Saturday, April 28, 2012

How can I pass parameters to controller/action not in URL?

I looked at routing, but I did not see a way to solve my problem.

I am looking for a way to create links to controller/actions and pass "large" or 'hidden' parameters.
I could use a from and post, but seems like a lot of work for 1 or 2 links in a view.

I understand the simple link call with 1 parameter.
echo  $html->link('View Post',  array('controller'  =>  'posts',  'action'  =>  'view',  5));

But, how can I pass large strings like

$largestring = "This is a large string that could be over 255 characters
long and might contain html special characters";

echo  $html->link('Update Post',  array('controller'  =>  'posts',  'action'  =>  'update',  $largestring));

or
$hidden = "password"; // or a variable I don't want to show in URL.

echo  $html->link('Unlock Safe',  array('controller'  =>  'safes',  'action'  =>  'unlock',  $hidden));

Is the only option to make these views forms and make these buttons, so I can
parse passed in variables using request->data?

Thanks,
Bill



View this message in context: How can I pass parameters to controller/action not in URL?
Sent from the CakePHP mailing list archive at Nabble.com.

--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: