Skip to content Skip to sidebar Skip to footer

Passing Variable From One View To Another View - Laravel 5.1

After an answer to my previous question, I replicated everything the top answer said and it works perfectly for him while it doesn't for me. I want to put two buttons on my home pa

Solution 1:

There are several things going on here.

Apart from what I mentioned just now in the comments (You are registering two routes that do different things under the same path, namely

Route::post('auth/register', [
'as' => 'writer_path',
'uses' => 'ProfessionController@displayForm'
 ]);

and

Route::post('auth/register', 'Auth\AuthController@postRegister');

) These coexist in the same routes.php file and there might be conflicts if the urls are the same

In addition, your

publicfunctiondisplayForm()
{
    $input = Input::get();
    $profession = $input['profession'];
    return view('auth/register', ['profession' => $profession]);
}

is returning as a view, a route, not a named route like in the instructions:

publicfunctiondisplayForm()
{
$input = Input::get();
$profession = $input['profession'];
return view('writerregistration', ['profession' => $profession]);

}

This, as I said should direct you to a view that you will create in a file called writerregistration.blade.php where you should put the code in the form that I passed here at the bottom of my answer:

Laravel Passing Data From One View to Another View

Solution 2:

try by adding 'method' to Form::open

{!! Form::open(['route' => ['writer_path'], 'method' => 'POST']) !!}

and use '\' on 'Input' on controller

$input = \Input::get();

Post a Comment for "Passing Variable From One View To Another View - Laravel 5.1"