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

[eluser]aktosci[/eluser]
I would like to make a link like that
Code:
< 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 )
#2

[eluser]TheFuzzy0ne[/eluser]
Have you tried:
Code:
$this->input->get('id');
#3

[eluser]aktosci[/eluser]
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
seminaire/edit
it works

but with url
/edit?id=2

I got


404 Page Not Found

The page you requested was not found.
#4

[eluser]TheFuzzy0ne[/eluser]
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...
#5

[eluser]xwero[/eluser]
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.
#6

[eluser]aktosci[/eluser]
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
#7

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

$id = $this->uri->segment(3);
[/quote]

aktosci - you need to read through this section of the user manual again:
[url="http://ellislab.com/codeigniter/user-guide/general/controllers.html"]http://ellislab.com/codeigniter/user-guide/general/controllers.html[/url]

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!
#8

[eluser]aktosci[/eluser]
Jedd

You are right

I could do

My old function
Code:
function edit()
    {
        $id = $this->uri->segment(3);
...
}

My new function
Code:
function edit($id)
    {
...
}
I should really read and reread all the documentation !!

Thanks
#9

[eluser]aktosci[/eluser]
Do you have any solution for a clean native authentification ?




Theme © iAndrew 2016 - Forum software by © MyBB