• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing 1 (or more) param's to a controller function?

#8
[eluser]PeteSig[/eluser]
Thanks for replies.

To elaborate on the background as to why I asked the question:

I have a function 'delete($id)' which deletes an item from a db.

I then decided to allow the user to select a number of items from a list and to delete all the selected items. So I created another function 'deleteSelected()' which gets all the selected item id's from $_POST, in the form of an array, and then runs throught them and does a delete($id) on them.

I thought it might be cleaner if I could call the single 'delete()' func with 1 or many item id's!

So, that's the background info, which I hope explains how come I don't know the number of parameters which might be passed.

Also, I wasn't sure on what the best practice might be - to pass the id's as an array via $_POST, or as parameters via the URL!?!?
I guess this is the real nub of the question - why pass via URL instead of via $_POST & / or visa versa?

Cheers

Pete


Messages In This Thread
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 10:01 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 10:09 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 10:30 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 10:53 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 11:10 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 11:11 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 11:18 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 11:24 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 11:31 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 11:48 AM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 12:22 PM
passing 1 (or more) param's to a controller function? - by El Forum - 11-02-2010, 06:36 PM
passing 1 (or more) param's to a controller function? - by El Forum - 11-03-2010, 03:54 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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