Part of the EllisLab Network
   
 
fail getting $_GET parameters
Posted: 17 April 2008 03: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 03:52 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
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 03:58 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  28
Joined  03-11-2008
xwero - 17 April 2008 03: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 04:29 AM   [ Ignore ]   [ # 3 ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  4839
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 04: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
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120532 Total Logged-in Users: 31
Total Topics: 126593 Total Anonymous Users: 3
Total Replies: 665537 Total Guests: 383
Total Posts: 792130    
Members ( View Memberlist )
Newest Members:  Rach123Glenn StavaImfaelSMS!persanulandrewknightKittx77AmityBetbulJahhn