• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing multiple variables on the URL

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

www.mysite.com/shoppingcart/

And I want to pass variables to it such as:

www.mysite.com/shoppingcart/?newproduct=12&promotion=yes&shipping=same&etc=etc&etc=etc&etc=etc

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?

Thanks!!

#2
[eluser]gunter[/eluser]
hm, you could parse the url with 3 or 4 lines code...

#3
[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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.