I want to be able to redirect from a from based on which button the user clicks.
If they click "Save and add another", it should redirect to the form. If they click "Save and finish", it should redirect to the main page.
I tried naming the buttons:
<button type="submit" name="add_another">Save & add another</button>
<button type="submit" name="add_done">Save & finish</button>
Then in my controller:
if(Input::get('add_another'))
{
return Redirect::to('add-team/project/'.Input::get('id'));
}
else
{
return Redirect::to('project/'.Input::get('id'));
}
However, it always redirects to the second return.
Has anyone gotten it to work?
Have you try dd(Input::all()) to see if you get the correct button name?
Yes. And the button name input is empty. But it's still there.
Have you tried this:
<button type="submit" name="add_another" value="Save & add another">Save & add another</button>
That did it. Thank you.
In hindsight, it was a pretty basic, obvious, non-Laravel question. Sorry to bother with this.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community