CodeIgniter Forums
how to pass empty variable into url? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: how to pass empty variable into url? (/showthread.php?tid=31302)



how to pass empty variable into url? - El Forum - 06-14-2010

[eluser]Unknown[/eluser]
hello..

i've create a class with index function like this

Code:
class Myclass extends Controller
{
function Myclass()
{
  parent::Controller();
}

function index($var1="",$var2="",$var3="",$var4="")
{
  .... bla bla bla
}
}

this URL is working the way i wanted:
http://blabla.com/codeigniter/myclass/index/content1/content2/content3/content4

but with this url, i can't get var4 value
http://blabla.com/codeigniter/myclass/index////content4

why is that happen? any solution?

sorry for my poor english Smile


how to pass empty variable into url? - El Forum - 06-14-2010

[eluser]WanWizard[/eluser]
You can't pass empty values in the URL, the repeated /// are stripped.

If the position of the variable is not relevant, you can simply use http://blabla.com/codeigniter/myclass/index/content4.
If it is relevant, use http://blabla.com/codeigniter/myclass/index/var1/content1/var4/content4, then use $this->uri->uri_to_assoc() to fetch them.


how to pass empty variable into url? - El Forum - 06-14-2010

[eluser]Unknown[/eluser]
woaah replied so fast..thanks.

ok got it..
the position is relevant, i will try: $this->uri->uri_to_assoc()