recovery men recovery men - 1 year ago 71
PHP Question

Redirect on different pages against different buttons (Laravel 5.3)

Here its my view i have 2 buttons one is save and exit and other is save and stay Here


<button type="submit" name="submit_1"> Submit and Exit</button>
<button type="submit" name="submit_2">save and stay Here</button>


public function store(Request $request)

$data['name'] = $request->input('name');
$data['adr'] = $request->input('adr');

$myuser = Data::create($data);
if(Input::get('submit_1')) {
return redirect()->route('myuser.index');
} elseif(Input::get('submit_2')) {
return redirect()->route('myuser.create');

I tried this but its not working for me kindly help me

Answer Source

you can try as:

<input type='submit' name='submit' value='submit_1'>
<input type='submit' name='submit' value='submit_2'>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download