Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

udoyen's avatar

View vs Redirect

I have a form that updates user information and not sure what I should use to display the end point, should it be a "return view" or "return redirect". Which is better.

0 likes
3 replies
EventFellows's avatar

After posting a form you would return a redirect (to an URL or a route). This Url or route would then return a view.

In your code it should be 2 different methods.

2 likes
topvillas's avatar
Level 46

If you just return a view, refreshing the page will post the data again. Always redirect after handling a post.

1 like
udoyen's avatar

@topvillas thanks for your response, will I be okay redirect and passing in data like so "redirect('/users/find', compact('user'));"?

Please or to participate in this conversation.