When submitting form on my website it should then display the Title and the body content however it seems to ignore the title and replace both with the body content ? below attached is the code that's causing issue. The DB has both fields name & body in place and is correct in the controller
This is the form for creating content -
<form action="{{ route('document', $project->slug) }}" method="POST">
<div class="add-form center-block">
<div class="input-group">
<input type="text" class="form-control" style="height:35px;" required="required" name="name" placeholder="Add document title">{{ old('document') }}
</div>
</div>
{{ csrf_field() }}
</form>
</div>
<form action="{{ route('document', $project->slug) }}" method="POST">
<div class="input-group">
<textarea id="summernote" name="document" required="required" placeholder="Craft your document here..."></textarea>
<script>
$('#summernote').summernote({
height: 200, // set editor height
minHeight: null, // set minimum height of editor
maxHeight: 300, // set maximum height of editor
focus: true // set focus to editable area after initializing summernote
});
</script>
</div>
<button type="submit" class="btn btn-dash">
<i class="fa fa-btn fa-plus"></i> create
</button>
{{ csrf_field() }}
</form>
And below is code that displays submitted content -
@foreach ($documents as $document)
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"> {!! nl2br($document->name) !!}</h4>
</div>
<div class="modal-body">
{!! nl2br($document->body) !!}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
@endforeach
</div>
JSfiddle with all code https://jsfiddle.net/bnqt2u2r/
Because you use 2 different form instead of 1