mardi 10 juillet 2018

using route resource form did not post to store function

I have a form which upon successful validation should show the desired result. But on button press the browser displays The page has expired due to inactivity. Please refresh and try again.

view page

<form class="form-horizontal" method="POST" action="">
                <div class="row" style="padding-left: 1%;">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label>Book Name</label><span class="required">*</span>
                                <input type="text" maxlength="100" minlength="3" required="required" runat="server" id="txtBookName" class="form-control" autocomplete="off" autofocus="autofocus" />
                            </div>                            
                            <div class="form-group">
                                    <button type="submit" class="btn btn-primary">Submit</button>        
                            </div>            
                        </div>
                </div>
        </form>

Route code

//web.php
Route::resource('book','BookController');

controller code

class BookController extends Controller
{   

    public function index()
    {
        //
    }


    public function create()
    {
        return view('pages.book');
    }
    public function store(Request $request)
    {
        $validatedInput = $request -> validate([
            'txtBookName' => 'required|string|min:3|max:100'
        ]);

        return $validatedInput;
    }
}

Form url http://127.0.0.1:8000/book/create

on submit button press, the page is redirected to http://127.0.0.1:8000/book and it displays The page has expired due to inactivity. Please refresh and try again.



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

Aucun commentaire:

Enregistrer un commentaire