Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I have a login controller that ask the user for an username and password. Then looks up the username in the database and so on...
It works perfectly in my pc. I deployed to production server yesterday and worked. Today, it didn't. It MAY have something to do with the production server configuration, but I have no clue.
My form is like this:
<?php echo form_open('login'); ?>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fas fa-user"></i></div>
</div>
<input type="text" class="form-control" name="username" placeholder="Usuario" required autofocus>
</div>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fas fa-key"></i></div>
</div>
<input type="password" class="form-control" name="password" placeholder="Contraseña" required>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block">Entrar</button>
</div>
<?php echo form_close(); ?>
and the controller is like this
public function index()
{
// Extraer campos necesarios
$username = $this->input->post('username');
$password = $this->input->post('password');
$this->output->enable_profiler();
// Buscar usuario.
$this->load->model('users_model');
$user = $this->users_model->getUserByUsername($username);
It turns out that both $username and $password variables are NULL in the controller. As you can see, I enabled the profiler and it says there is no post data. I have no clue what's going on.
Thanks in advance for the help.
Sorry, solved. Turns out my hosting provider enabled httpS overnight and I didn't update the $config['base_url'], so it didn't route properly.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Its work yesterday day I didn't do any changes but today but unh?
problem is : when ever from submit button is click its open a popup and show error message
here is the blade file code
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Add Brand</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="table-responsive">
<form method="POST" action="{{route('barnd.store')}}" enctype="multipart/form-data">
#csrf
<div class="form-group">
<h5>Brand name English <span class="text-danger">*</span></h5>
<div class="controls">
<input type="text" name="brand_name_eng" class="form-control">
</div>
#error('brand_name_eng')
<span class="text text-danger">{{ $message }}</span>
#enderror
</div>
<div class="form-group">
<h5>Brand name German <span class="text-danger">*</span></h5>
<div class="controls">
<input type="text" name="brand_name_gem" class="form-control">
</div>
#error('brand_name_gem')
<span class="text text-danger">{{ $message }}</span>
#enderror
</div>
<div class="form-group">
<h5>Brand Image <span class="text-danger">*</span></h5>
<div class="controls">
<input type="file" name="image" class="form-control">
</div>
#error('image')
<span class="text text-danger">{{ $message }}</span>
#enderror
</div>
<div class="text-xs-right" style="float: right;">
<button type="submit" class="btn btn-rounded btn-primary">Update</button>
</div>
</form>
</div>
</div>
<!-- /.box-body -->
</div>
here is my controller with just simple validation
public function store(Request $request)
{
$validated = $request->validate([
'brand_name_eng' => 'required',
'brand_name_gem' => 'required',
'image' => 'required',
]);
}
then I try to test this but in the view I click just update button I got this
i have no idea why suddenly I am getting this kind of error
NOTE: and I enable log there no log as well
how can I solve this? and where its come from this error?
You can Die and Dump your request() to see if your request is getting to your server or not!
If not solved check the mass assignment functionality on your model.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am using Laravel 6 to create an insert blade. When I wanted to display the view, it generated an error as shown below:
error:syntax error, unexpected end of file
With this code:
#extends('layouts.app')
#section('title','insert')
#section('content')
#if(session('message'))
<div class="">
{{session('message')}}
</div>
#endif
<br/>
<form class="" id="feedback_form" method="post" action="{{route('insert')}}">
<input type="hidden" name="_token" value="{{csrf_token()}}" />
<input type="hidden" name="id" value="" />
<div class="">
<label for="name" class=" ">Tên sản phẩm<span class=""> :</span></label>
<input type="text" name="name" class=""/>
</div>
<div class=" ">
<label for="name" class=" ">Mô tả<span class=""> :</span></label>
<input type="text" name="description" class=""/>
</div>
<div class=" ">
<label for="name" class=" ">Danh mục<span class=""> :</span></label>
<select name="cate">
#foreach($cate as $ca)
<option value="{{ $ca->id }}">{{ $ca->name }}</option>
</select>
</div>
<div class="">
<div class="">
<button class="btn btn-success" type="submit">SAVE</button>
<button class="btn btn-default" type="reset">Close</button>
</div>
</div>
</form>
#endsection
What's the problem?
Just put this code
you forgot to put #endforeach
<select name="cate">
#foreach($cate as $ca)
<option value="{{ $ca->id }}">{{ $ca->name }}</option>
#endforeach
</select>
when you write foreach in a blade file you need to end it by endforeach.same for if in blade file like endif.So here is your error for not endforeach.
Try this,
#foreach($cate as $ca)
<option value="{{ $ca->id }}">{{ $ca->name }}</option>
#endforeach
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
The POST method is not supported for this route. Supported methods: GET, HEAD, PUT, PATCH, DELETE.
I tried to do every solutions but it still same problem
web.php
<?php
Route::resource('tasks','TasksController');
View tasks/create
<form action="{{route('tasks.store') }}" method="POST" class="form-horizontal">
#csrf
<!-- Task Name -->
<div class="form-group">
<label for="task-name" class="col-sm-3 control-label">Task</label>
<div class="col-sm-6">
<input type="text" name="name" id="task-name" class="form-control" value="" required>
</div>
</div>
<!-- Add Task Button -->
<div class="form-group">
<div class="col-sm-offset-3 col-sm-6">
<button type="submit" class="btn btn-default">
<i class="fa fa-btn fa-plus"></i>Add Task
</button>
</div>
</div>
</form>
Controller TasksController
public function index()
{
$tasks=Task::all();
return view('tasks.index',compact('tasks'));
}
public function create()
{
//
return view('tasks.create');
}
public function store(Request $request)
{
$this->validate($request,[
'name'=>'required|max:20'
]);
//Create Tasks
$task=new Task;
$task->name=$request->input('name');
$task->save();
return redirect('/tasks')->with('success','Task Created');
}
Help me i don't know what is a problem
Thank you
try this to web.php
Route::resource('tasks','TasksController')->names([
'store' => 'tasks.store'
]);
or add this
Route::post('/tasks/store', 'TasksController#store')->name('tasks.store');
Hope this helps
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have created a form but it does not work after clicking the submit button. What problem do I have?
<div class="col-sm-12 col-lg-6 mb-4">
<div class="card border-primary">
<div class="card-header border-primary bg-primary">Create E-Pin</div>
<div class="card-body">
<from class="form-group" method="post" action="{{ route('frontend.epin.store') }}">
#csrf
<div class="form-group">
<label >E-pin Amount</label>
<input type="text" name='amount' class="form-control">
</div>
<button type="submit" class="btn btn-primary">Create</button>
</from>
</div>
</div>
</div>
Of course it not work because you made a typo
<form class="form-group" method="post" action="{{ route('frontend.epin.store') }}">
#csrf
<div class="form-group">
<label >E-pin Amount</label>
<input type="text" name='amount' class="form-control">
</div>
<button type="submit" class="btn btn-primary">Create</button>
</form>
It should be form not from.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am new to bootstrap and HTML and want to know how can I give same spacing between form label and the text field, throughout the form. I have attached code snippet as well as an output form.
[code for the form][1][ Form output][2]
You are doing good. You need to just group your elements. Here I am going to write HTML code.
<div class="col-lg-12 form-group">
<div class="col-lg-3 text-right">
<label class="">small</label>
</div>
<div class="col-lg-5">
<input type="text" class="form-control">
</div>
</div>
<div class="col-lg-12 form-group">
<div class="col-lg-3 text-right">
<label class="">long lebel text</label>
</div>
<div class="col-lg-5">
<input type="text" class="form-control">
</div>
</div>
You need to set your label box and text box separate and push the label to the extreme right. You can check here. Hope it will help you. :)
you can use a specific column indent for your label:
<div class="form-group form-inline">
<label class="col-md-2" for="exampleInputEmail1">Email address:</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
</div>
<div class="form-group form-inline">
<label class="col-md-2" for="idForTextfield">A very long text for this label:</label>
<input type="text" class="form-control" id="idForTextfield" placeholder="your text">
</div>
also you can add some column indent for your text field so that it bounden with your limited space just add col-md-2 in the class for <input> tag.
Sample here Code sample.
Happy coding :)