How can I pass multiple variables/values through the uri? |
I've been using the uri to pass multiple values to my model with something like...
Code: <?php echo anchor("main/request_details/$r->submitTime", 'View'); ?> and using it to make a query in the model with... Code: $this->db->where('submitTime', $this->uri->segment(3)); but now I need to pass 2 values through the url. Is there a way to do this or am I going about this the wrong way perhaps? Thanks
You can just add a new segment like you are when adding the 3rd.
Parameters are automatically passed to the controller/method as arguments, like <?php echo anchor("main/request_details/$r->submitTime/anotherParameter", 'View'); ?> You just need to capture them in the method and would be available like: PHP Code: function request_details($submitTime = '', $anotherParameter = '') //assign the variables being passed, AND set a default value By setting the default values in the method, you can use the controller for: http://yoursite.com/main/request_details http://yoursite.com/main/request_details/{submit_time} http://yoursite.com/main/request_details..._parameter}
|
Welcome Guest, Not a member yet? Register Sign In |