I'm creating a site in Laravel that uses a controller to validate the information from a form and then return the user to a Thanks page. On that thanks page, I would like to use the user's name and gender.
In my controller I have:
return redirect()->route('thanks')->with(['success' => 'success', 'name' => $name, 'gender' => $gender]);
Then, in the view, I have:
<p>{{ $name }}</p>
<p>{{ $gender }}</p>
But, for some reason I keep getting this error:
Undefined Variable: Name
What's weird is that if I die and dump $name within the controller, it shows it properly on the screen.
I've tried various different ways to try to pass multiple variables through to the view as well as different variable names and forms to receive it again... but haven't been able to make it work.
Do you guys have any idea where I could be going wrong? As, always, I really appreciate your help! All ideas, suggestions, and comments are welcome :) Thanks!!