Part of the EllisLab Network
   
 
fail getting $_GET parameters
Posted: 17 April 2008 04:44 AM   [ Ignore ]  
Summer Student
Total Posts:  28
Joined  03-11-2008

I try to send by url like:

"http://localhost/ci/index.php/admin/usuarios/modify/id/1" 

and I get the parameters with:

$id$this->CI->input->get('id'); 

but it´s no result, and the same dumping

$_GET 

variable.

What i am doing wrong?

Do i need to edit .htaccess? do i need to modify routes.php? ...

Profile
 
 
Posted: 17 April 2008 04:52 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4785
Joined  07-14-2006

you have to get the 1 with $this->uri->segment(n) so you can remove the id segment.

Profile
 
 
Posted: 17 April 2008 04:58 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  28
Joined  03-11-2008
xwero - 17 April 2008 08:52 AM

you have to get the 1 with $this->uri->segment(n) so you can remove the id segment.

so it´s a bit annoying, isn´t it? if i send many parameters, i need to know name and position…

thanks.

Profile
 
 
Posted: 17 April 2008 05:29 AM   [ Ignore ]   [ # 3 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4785
Joined  07-14-2006

if you want to send key-value pairs you can use the uri->uri_to_assoc(n) method. You can’t use get with a path_info url.

If you want to use a query string set the uri_protocol to PATH_INFO and enable_query_strings to TRUE. This way you can use input->get().

The choice is up to you smile

Profile
 
 
Posted: 17 April 2008 05:55 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  28
Joined  03-11-2008

Ok! it was what i´m looking for…

It´s the first time I get parameters $_GET by uri string and not from the variable, I think it may be a security decision…

Profile