CodeIgniter Forums
How can I pass array as parameter from view to controller when click an anchor tag? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How can I pass array as parameter from view to controller when click an anchor tag? (/showthread.php?tid=43419)



How can I pass array as parameter from view to controller when click an anchor tag? - El Forum - 07-11-2011

[eluser]Unknown[/eluser]
Like this
Code:
<a id='proceed' href="&lt;?= base_url() ?&gt;index.php/controller_name/action_name/parameter_array">Go</a>



How can I pass array as parameter from view to controller when click an anchor tag? - El Forum - 07-11-2011

[eluser]cpass78[/eluser]
The only way that 'I'm' aware of to do this is to either pass the data as hidden input fields in a form or use
Code:
$this->session-set_userdata(array('your values'));

*Edit,

Just realized you could do this with jquery also, just disable the click event for the id of the url and trigger a post event instead.


How can I pass array as parameter from view to controller when click an anchor tag? - El Forum - 08-03-2011

[eluser]nuwanda[/eluser]
An array of data passed via a url is by definition a form submission :-)

If it's only a few parameters then pass them via url segments.