recovery men recovery men - 3 months ago 33
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


you can try as:

<input type='submit' name='submit' value='submit_1'>
<input type='submit' name='submit' value='submit_2'>