GET Method, Query string with Clean url |
[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!!
[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
[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
[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 .. |
Welcome Guest, Not a member yet? Register Sign In |