CodeIgniter Forums

Full Version: How will query string be formatted
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]bleu[/eluser]
The current url for
Code:
http://localhost/~xyz/index.php?c=controller&m=method&id1=123

is coming as
Code:
http://localhost/~xyz/index.php/controller/method/123/


How will this url come
Code:
http://localhost/~xyz/index.php?c=controller&m=method&id1=a123&id2=b123&id3=c123&id4=f123&id5=e123&id6=f123

El Forum

[eluser]animatora[/eluser]
[quote author="bleu" date="1331219864"]The current url for
Code:
http://localhost/~xyz/index.php?c=controller&m=method&id1=123

is coming as
Code:
http://localhost/~xyz/index.php/controller/method/123/


How will this url come
Code:
http://localhost/~xyz/index.php?c=controller&m=method&id1=a123&id2=b123&id3=c123&id4=f123&id5=e123&id6=f123
[/quote]

Code:
http://localhost/~xyz/index.php/controller/method/a123/b123/c123/d123....
in controller you should have:

Code:
public function method($id1, $id2, $id3...)
{
}

El Forum

[eluser]bleu[/eluser]
In My controller I want to use it in a fashion as
a condition
Code:
if($_GET["id5"]=="f123"){ }

El Forum

[eluser]animatora[/eluser]
[quote author="bleu" date="1331220958"]In My controller I want to use it in a fashion as
a condition
Code:
if($_GET["id5"]=="f123"){ }

[/quote]


Controller

Code:
public function my_method($id1, $id2, $id3)
{
   if($id1 == "string")
    // Some code here
}

El Forum

[eluser]bleu[/eluser]
[quote author="animatora" date="1331221744"][quote author="bleu" date="1331220958"]In My controller I want to use it in a fashion as
a condition
Code:
if($_GET["id5"]=="f123"){ }

[/quote]


Controller

Code:
public function my_method($id1, $id2, $id3)
{
   if($id1 == "string")
    // Some code here
}
[/quote]


Thanks but what if I want to use it in another method and I cannot send $id1 from my_method to that other method , I believe I will have to get it from the url.

How will I do that?

El Forum

[eluser]animatora[/eluser]
Get it from URL like:
Code:
$this->uri->segment(3);// Will get 11 from example.com/class/method/11

Check the URL class for more examples
http://ellislab.com/codeigniter/user-gui...s/uri.html