![]() |
GET Method, Query string with Clean url - 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: GET Method, Query string with Clean url (/showthread.php?tid=33573) |
GET Method, Query string with Clean url - El Forum - 08-31-2010 [eluser]TheIgniter[/eluser] Hi there, I have a litle problem and i hope that someone will help me : Suppose we have a function taht can filter data with 2 parameter .. I want to send some value to this function with the get method .. so i have : Code: <form method="get" action="<?php echo base_url() . 'mycontroller/myfunction/filter_by/'?>"> When i submit, the url become : Code: mysite.com/mycontroller/myfunction/filter_by/?pays1=france&pays2=canada So my question is how can i get this : Code: mysite.com/mycontroller/myfunction/filter_by/france/canada I did some search but not enougth to undertund how to.. THanks in advance!! GET Method, Query string with Clean url - El Forum - 08-31-2010 [eluser]CI_avatar[/eluser] During on click of the submit button the default link will be generated above like Code: (mysite.com/mycontroller/myfunction/filter_by/?pays1=france&pays2=canada) But you may route the link Code: mysite.com/mycontroller/myfunction/filter_by/?pays1=france&pays2=canada Code: mysite.com/mycontroller/myfunction/filter_by/france/canada Make a controller that will receives the get request then route it to the destination controller with rewritten URL getcontroller.php Code: //code somewhat like this GET Method, Query string with Clean url - El Forum - 08-31-2010 [eluser]pbreit[/eluser] Will "$this->input->get" work there? Isn't the whole problem that querystrings don't work in CodeIgniter? As outlined in this thread: http://ellislab.com/forums/viewthread/159382 A very small bit of code will enable you to process a querystring as usual. Then you don't have to go through the idiocy of converting a proper querystring into URI parts. Code: class MY_Input extends CI_Input GET Method, Query string with Clean url - El Forum - 08-31-2010 [eluser]TheIgniter[/eluser] [quote author="CI_avatar" date="1283321068"]During on click of the submit button the default link will be generated above like Code: (mysite.com/mycontroller/myfunction/filter_by/?pays1=france&pays2=canada) But you may route the link Code: mysite.com/mycontroller/myfunction/filter_by/?pays1=france&pays2=canada Code: mysite.com/mycontroller/myfunction/filter_by/france/canada Make a controller that will receives the get request then route it to the destination controller with rewritten URL getcontroller.php Code: //code somewhat like this Thanks to both of u.. So, i will stick with your suggestion .. |