lundi 27 avril 2020

Unable to get input data from Form submit GET request in laravel 5.1

I have a search form that is sending a GET request to the method that it is using to view the form:

                <form class="form-horizontal" method="GET" action="">
                    <div class="form-group form-group-sm">
                        <div class="col-sm-3">
                            <input type="text" name="inputdate" class="form-control datepicker" placeholder="Date" >
                        </div>
                        <div class="col-sm-2">
                            <button class="btn btn-primary btn-sm btn-block" type="submit">
                                <i class="fa fa-search" aria-hidden="true"></i>
                                Search 
                            </button>
                        </div>
                    </div>
                </form>

And the route:

Route::group(array(
    'middleware' => 'auth',
    'prefix' => '!',
    'namespace' => 'LoggedIn',
    'as' => 'LoggedIn.',
), function() {

    .................

    Route::group(array(
        'prefix' => 'StudentModule',
        'namespace' => 'StudentModule',
        'as' => 'StudentModule.'
    ), function () {

        ............

        Route::group(array(
            'prefix' => 'StudentHomeWork',
            'as' => 'StudentHomeWork.',
        ), function () {

            Route::get('/', array(
                'as' => 'index',
                'uses' => 'StudentHomeWorkController@index'
            ));
        });

    ..................

    });

    ...............
});

And my controller:

public function index()
{
    $searchParam = request('inputdate') ? request('inputdate') : date('Y-m-d');

    echo $searchParam; // this is showing no data
}

The problem is, i couldn't get the data from submitted form. I have used every option that i found in stackoverflow but couldn't get the data. Can anyone point me out what i am missing! My laravel version is 5.1

Note: I am using this method in Laravel 5.8 + 6. Which is working just fine



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3eR5AQW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire