CodeIgniter Forums

Full Version: Passing multiple variables on the URL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]omed habib[/eluser]
I have the following URL:

And I want to pass variables to it such as:

However, I don't want to pass them as subdirectories because if they are NOT present, the function will return an error.

How do I pass multiple variables in the URL without having to define each variable as inputs to the function and if they are not present at all the function will still work?


El Forum

hm, you could parse the url with 3 or 4 lines code...

El Forum

[eluser]Michael Wales[/eluser]
You could use URL segments and routing.

Route the /shoppingcart/ segment to a controller/method - then just parse out the other segments.

Honestly, this seems pretty sloppy and I would just use a session if possible.