Query string does not pass the parameter... |
[eluser]Peter Lachky[/eluser]
Hello everybody, for a certain reason I have to use query_strings for one controller. It's special case of receiving data via HTTP request from another provider and I do not have the option to configure the HTTP request. Anyway, I have enabled the query strings Code: $config['enable_query_strings'] = TRUE; and in the controller which handles this HTTP request I have this function just to check whether I am getting the request: Code: function topovat($id) { The name of the controler is toping.php so when I do this HTTP request Code: http://myweb.com/index.php?c=toping&m=topovat&id=test I should be able to see the content of the id parameter. However, I can only see a warning saying Quote:Missing argument 1 for Toping::topovat(). Now what's wrong? (And no, I haven't configured anything for this controller in routes config) Thank you.
[eluser]JHackamack[/eluser]
Have you tried removing the $id from the "topovat($id)" and doing a print_r($_GET);
[eluser]Dyllon[/eluser]
Use the input class to get your ID Code: $id = $this->input->get('id');
[eluser]laytone[/eluser]
I ran into this problem once, Here is my forum thread: http://ellislab.com/forums/viewthread/129318/ after implementing the input class extension somebody could browse to http://mysite.com/index.php/controller/m...l&var2=val I was able to retrieve my variable like this $id = $this->input->get('id'); after you fallow the instruction in the forum post above, make your function start like this: Code: function yourfunc($id = 0){ now you can invoke the method two ways: index.php/controller/yourfunc/1234 or index.php/controller/yourfunc/?id=1234 |
Welcome Guest, Not a member yet? Register Sign In |