Currently I have Bootstrap Grids in one page as shown in the picture below.
My Bootstrap Grids
And I want grid as shown in picture below with red indicator
Wanted my Bootstrap Grid Like This
Codes
<div class="row">
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
</div>
Add some offset to your last col, like :
<div class="col-md-6 col-md-offset-3">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="#" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>My label</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
Related
I tried to update a post using edit route but when I send the form and use the update function give me an error
my code is
<form action="/posts{{$posts->id}}" method="POST">
#method('PUT')
#csrf
<label for="">title</label>
<input type="text" name="title" class="form-control" >
<label for="">body</label>
<textarea type="text" name="body" class="form-control">{{$post->body}}</textarea>
<input type="submit" class="btn btn-primary" value="edit">
You have to use like this
<form action="{{url('')}}/posts/{{$post->id}}" method="POST">
#csrf
<label for="">title</label>
<input type="text" name="title" class="form-control" >
<label for="">body</label>
<textarea type="text" name="body" class="form-control">{{$post->body}}</textarea>
<input type="submit" class="btn btn-primary" value="edit">
And in your route use like this
Route::post('/posts/{id}', ...)
You are missing a / in your action
action="/posts/{{ $posts->id }}"
You could do the following :
<form action="{{ route('route.name', $post->id) }}" method="POST">
#csrf
<label for="">title</label>
<input type="text" name="title" class="form-control" >
<label for="">body</label>
<textarea type="text" name="body" class="form-control">{{$post->body}}</textarea>
<input type="submit" class="btn btn-primary" value="edit">
And for the route :
Route::post('/posts/{id}', 'Controller#function')->name('route.name');
I put a hidden method that I found on laravel documents and worked fine
<form action="/posts/{{$post->id}}" method="POST">
#csrf
<label for="">title</label>
<input type="text" name="title" class="form-control" >
<label for="">body</label>
<textarea type="text" name="body" class="form-control">{{$post->body}}.
</textarea>
<input type="submit" class="btn btn-primary" value="edit">
<input type="hidden" name="_method" value="PUT">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>
I have an issue submitting my updated data to database.
It accepts all input but when I'm trying to get it saved it gets the error.
This is my route:
Route::resource('Sales', 'SalesController');
How I put my data:
axios.put('/Sales/' + id)
My update method:
public function update(Request $req, $id){
$sales = Sales::find($id);
$sales = new Sales;
$sales->itemQty = $req['itemQty'];
$sales->itemID = $req['itemID'];
$sales->save();
}
My Editing form:
<div class="card-body" v-for="(sale, index) in sales" :key="sale.id">
<form action="/Sales" method="post">
<div>
<input type="hidden" name="_token" :value="csrf">
<div class="form-group">
<div class="form-inline">
<div class="mr-3 mt-2">Item ID: </div>
<input class="form-control mt-2 col" name="itemID[]" maxlength="12" v-model="sale.itemID">
</div>
<div class="form-inline">
<div class="mr-2 mt-2">Quantity: </div>
<input type="number" min="1" class="form-control mt-2 col" placeholder="Quantity" name="itemQty[]" v-model="sale.itemQty">
</div>
</div>
</div>
<div class="updatesale" style="margin:0 auto; text-align: center;">
<button class="btn btn-success mt-2" type="button" name="button" v-on:click="updateSalesRec(sale.id)">Update</button>
</div>
</form>
</div>
What is wrong with it?
You don't need to create another instance of the Sales object after finding it:
public function update(Request $req, $id){
$sales = Sales::find($id);
$sales->itemQty = $req['itemQty'];
$sales->itemID = $req['itemID'];
$sales->save();
}
I don't think your intention is to have your data submitted in array. So remove [] from the input field names:
<div class="card-body" v-for="(sale, index) in sales" :key="sale.id">
<form action="/Sales" method="post">
<div>
<input type="hidden" name="_token" :value="csrf">
<div class="form-group">
<div class="form-inline">
<div class="mr-3 mt-2">Item ID: </div>
<input class="form-control mt-2 col" name="itemID" maxlength="12" v-model="sale.itemID">
</div>
<div class="form-inline">
<div class="mr-2 mt-2">Quantity: </div>
<input type="number" min="1" class="form-control mt-2 col" placeholder="Quantity" name="itemQty" v-model="sale.itemQty">
</div>
</div>
</div>
<div class="updatesale" style="margin:0 auto; text-align: center;">
<button class="btn btn-success mt-2" type="button" name="button" v-on:click="updateSalesRec(sale.id)">Update</button>
</div>
</form>
</div>
Hope this is useful.
I'm using Laravel 5.6, and the following is my view (leads/show.blade.php):
<form method="post" id="student_form">
{{csrf_field()}}
<span id="form_output"></span>
<div class="form-group">
<label>Choose Group for Your Lead</label>
<select name="group_id" id="group_id" class="form-control">
#foreach($groups as $group)
<option value="{{$group->id}}"> {{$group->name}}</option>
#endforeach
</select>
<input type="hidden" name="customer_id" id="customer_id" value="{{$lead->id}}">
</div>
<div class="modal-footer">
<input type="hidden" name="student_id" id="student_id" value="" />
<input type="hidden" name="button_action" id="button_action" value="insert" />
<input type="submit" name="submit" id="action" value="Add" class="btn btn-info" />
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
and the route is :
Route::post('leads/savegroup', 'LeadsController#savegroup')->name('leads.savegroup');
Please help me to find the error in this route.
Add <form method="post" id="student_form" action="{{ url('/leads/savegroup') }}">
to your code.As you are posting data to empty route .You need to define some action.
I wanted to change the language/word of the highlighted as shoen in the picture below
Reference picture
CODES
<div class="col-md-6">
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 10px;" action="{{ URL::to('importExcel/1') }}" class="form-horizontal" method="post" enctype="multipart/form-data">
<label>Please upload file</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="import_file"/> <br>
<button class="btn btn-primary">Import File</button>
</form>
</div>
I have wrote a form in bannervipsites.php :
<form role="form" action="index.php" method ="post">
<div class="form-group">
<label>نام بنر :</label>
<input class="form-control" name="sname" placeholder="نام فارسی یا لاتین بنر">
</div>
<div class="form-group">
<label>URL : </label>
<input class="form-control" name="surl" placeholder="http://">
</div>
<div class="form-group">
<label>Upload banner :</label>
<input type="file" name='upfile' id='upfile' class="filestyle" data-buttonName="btn-primary" data-buttonBefore="true" data-icon="false" >
<input type='hidden' name='bform' value='file'>
<input type='hidden' name='MAX_FILE_SIZE' value='100720'>
</div>
<?php
if ($acctype != 1) {
?>
<div class="form-group">
<label>حداکثر بازدید در ساعت : (عدد 0 یعنی نامحدود)</label>
<input class="form-control" name="scph" placeholder="سقف بازدید در ساعت از چه عددی فراتر نرود؟">
</div>
<?php
}
?>
<div class="form-group">
<label>روی مربع کلیک کنید : </label>
<div class="g-recaptcha"></div>
</div>
<input type="hidden" name="fform" value="bannervip">
<input type="hidden" name="sid" value="0">
<input id="submit" name="submit" value="اضافه کردن" class="btn btn-success" type="submit">
<button type="button" class="btn btn-default" data-dismiss="modal">بستن</button>
</form>
and then post it to index.php
but upfile (the name of uploaded file) does not send.
I can not get
echo $_FILES['upfile']['tmp_name'];
in index.php
what is the problem? it's very odd for me.
it was working in last template .(index.php is ok i'm sure)
what is wrong with bootstrap form
Add
enctype= "multipart/form-data"
to your form.