php - Post Two Forms From Same Webpage In Laravel -
i creating 1 page website using laravel have login form , registration form on same page.
i wish route them respective controller functions, say, accesscontroller@login
, accesscontroller@register
respectively. how can achieve this, when both forms route be:
route::post('/', 'controllername@function')
it's bad idea, can achieve want doing this:
add
<input type="hidden" name="action" value="register">
,<input type="hidden" name="action" value="login">
signup , login forms accordinglyin controller method check form submitted:
$action = input::get('action'); // handle register request if ($action === 'register') { return $this->register(); // handle login request } elseif ($action === 'login') { return $this->login(); } else { throw new exception("unknown action"); }
Comments
Post a Comment