Welcome Guest, Not a member yet? Register   Sign In
CONTROLLERS, single method or different methods for different actions?
#3

Quote:Let's say I have a Controller and a View where you can edit a customer (where 123 is the customer's unique ID):
/customer/edit/123

do not do this. i know its in almost every api tutorial to do it this way - but if you have any choice at all do not because exposing the customer id, or a db record id in the URL for a page that you need to be logged in to access -  is insecure.

Quote:then do some jiggery poker

sounds legit  Dodgy

so here is another way - yes (obviously) you should have separate methods, because you need to call different validation etc. but you also can call the same form url in your different forms - just put a hidden form field like
PHP Code:
form_hidden'task''editcolors' ); 

then in the controller method that the form goes to - pick up the 'task' and route to the correct method based on the hidden form field - and make the method private like _editcolors()
Reply


Messages In This Thread
RE: CONTROLLERS, single method or different methods for different actions? - by cartalot - 05-10-2016, 02:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB