Token Mismatch...sometimes

Posted 4 years ago by itstrueimryan

Hi there. Making just a basic contact form (Laravel 4.2.*), nothing I haven't done a million times...but all of a sudden I'm getting a Token Mismatch errror about half of the times I submit the form. Sometimes it works, sometimes it doesn't. I've commented out all the controller contact method code and reduced the form to one field, just to make sure it wasn't anything weird I was doing.

Route::post('contact', ['before'=>'csrf', 'uses' => 'SiteController@contact']);
{{ Form::open(array('url' => 'contact', 'class' => 'write-form', 'id' => 'contact-form')) }}

    <div class="form-group">
        <label for="first-name">First Name</label>
        <input class="form-control" type="text" name="first_name" id="first-name" value="{{ Input::old('first_name') }}" />

    <input type="submit" value="Submit" class="btn btn-default" />

{{ Form::close() }}

I'm not using a database for this project, is the only difference from the usual. Anyone know what's going on? Thanks.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.