Welcome Guest, Not a member yet? Register   Sign In
how to retrieve a get

I would like to make a link like that
< a h r ef=index.php?id=2 >edit</a>

I don't know how to do it with CI

In my next page, I have the variable $REQUEST[id] and I cant continue my work. And this value will be 2

I am looking for examples.

My goal is to create a simple app

I have a table with 2 fields id, name

- add data in a table ( I can do that )
- delete data
- update date
- list data ( I can do that whith CI )

Have you tried:

It does not work because I cannot make a url with ?id=2
But only like that edit/2

And the 2 is supose to be my id.
first problem : Before I knew that it was my id now I just know that it is my fist parameter. But I can manage

If I create a url like this
it works

but with url

I got

404 Page Not Found

The page you requested was not found.

OK, you either need to stick with using URL segments, in which case you might want to take a look at my [url="http://ellislab.com/forums/viewthread/106502/"]Alternate URI Syntax library[/url], as it allows you to send key-value pairs safely via get without the need for query strings. Or you can enable query strings in your config.php file. Your syntax is incorrect for using query strings. The question mark should come after the index page, and should be in a forum similar to this: mysite.com/index.php?c=controller&m=method&arg1=some_data&arg2=34 and so on...

aktosci you need to route your url if you want to shorten it.

The GET global values are destroyed by default. You need to change the uri_protocol to a path_info setting that works on your server and set the enable_query_strings to true. Then you can use GET.

Thank you for your guidance

I just add this

$id = $this->uri->segment(3);

And I have my variable $id for my next lignes of code

thank you very much :

I did one step further ... I still have few km to do !!! lol

[quote author="aktosci" date="1236539178"]
I just add this

$id = $this->uri->segment(3);

aktosci - you need to read through this section of the user manual again:

Specifically the section called: Passing URI Segments to your Functions

I suggest things are probably a lot easier than you are making them. Assuming otherwise was the mistake I made when I first started playing with CI - and it's a very easy mistake to make!


You are right

I could do

My old function
function edit()
        $id = $this->uri->segment(3);

My new function
function edit($id)
I should really read and reread all the documentation !!


Do you have any solution for a clean native authentification ?

Theme © iAndrew 2016 - Forum software by © MyBB