mardi 2 janvier 2018

Prevent resubmission post route in laravel

I want to create search form and then show result by view. After i submit the result show in view searchome but when refresh page after submit i get re submission how can i search by post route and prevent re submission by refresh page?

public function src_fn(){
  $para=Input::get('txt_pro_id');
  $result=DB::table('testing_tbl')->where('pro_id','=',$para)->paginate(5);
  return View::make('searchome')->with('result',$result);
}

My search view

<form method="post" action="" name="frm_srch" role="search">
    {!! csrf_field() !!}
    <input type="Text" name="txt_pro_id" id="txt_pro_id">
    <input type="Submit" value="OK">
</form>

My searchome view

<table cellpadding="10px" width="100%" class="table_str">
    <thead style="font-size: 11px;">
        <tr>
            <th>Pro ID</th>
            <th>Pro Name</th>
            <th>Pro price</th>
        </tr>
    </thead>
    <tbody style="font-size: 11.5px;">
        @foreach($result as $vals)
            <tr scope="row" style="border-bottom: solid 1px #ccc">
                <td></td>
                <td></td>  
                <td></td>                   
            </tr>
        @endforeach
    </tbody>
</table>
<?php echo $result->render(); ?>

My Route

Route::post('findsresult', 'SearchController@src_fn')->name('findsresult');



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2EBu0vt
via IFTTT

Aucun commentaire:

Enregistrer un commentaire