Multiple Form update

Posted 7 months ago by bitcoinboy

I'm looking for a better way to store multiple forms update. E.g: in one page I have multiple forms each one have a hidden input with its type.

<input type="hidden" name="type" value="type_of_form">

Currently I'm handling it like this:

        $type = request('type');


        if ($type === 'basic')
            $this->updateBasic();

        if ($type === 'legal')
            $this->updateLegal();

        if ($type === 'address')
            $this->updateAddress();

        if ($type === 'address')
            $this->updateAddress();

I think this is simple but too long. Is there any simplest way ?

Please sign in or create an account to participate in this conversation.