Friday, March 17, 2017

Laravel - how to write form action for post comment

To post a comment write form action like this

<form method="post" action="/comments') }}">

                 

                    <div class="row">
                        <div class="form-group">
                            <div class="col-md-12">
                                <label>Comment *</label>
                                <textarea maxlength="5000" rows="10" class="form-control" name="body" id="body" placeholder="here will be your comment"></textarea>
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-md-12">
                            <input type="submit" value="Post Comment" class="btn btn-primary btn-lg" data-loading-text="Loading...">
                        </div>
                    </div>
    </form>

and route code is

Route::post('posts/{post}/comments','CommentController@store');

but prob is when it shows error Parse error: syntax error, unexpected '}', expecting ',' or ')' (View: the showing error line is

<form method="post" action="/comments') }}">

so where is my mistake in this line? how to solve it?



via Masum

Advertisement