Codeigniter 3 select form error not showing on form submit - codeigniter-3

I was following a youtube tutorial on making a codeigniter college management system
but i am stuck at a point.. when i try to submit the form on wamp server
select form fields not showing requied error on form submit
i have checked the name fields of the form inputs matching the database table but still when the form is submitted without any fiilling any fields
the role and gender select field errors doesnt show
here is my code
controller
welcome.php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* #see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
//$this->load->helper('url');
$this->load->view('home');
}
public function adminRegister()
{
$this->load->model('queries');
$roles = $this->queries->getRoles();
// print_r($roles);
// exit();
$this->load->view('register',['roles'=>$roles]);
}
public function adminLogin()
{
echo 'Login';
}
public function adminSignup()
{
//echo 'Registered succesfully';
$this->form_validation->set_rules('username','Username','required');
$this->form_validation->set_rules('email','Email','required');
$this->form_validation->set_rules('gender','Gender','required');
$this->form_validation->set_rules('role_id','Role','required');
$this->form_validation->set_rules('password','Password','required');
$this->form_validation->set_rules('confpwd','Password Again','required');
$this->form_validation->set_error_delimiters('<div class="text-danger">','</div>');
if($this->form_validation->run()){
echo 'validation passed';
}else{
//echo 'validation error';
echo validation_errors();
}
}
}
and views
register.php
<?php include('inc/header.php');?>
<div class="container mt-2">
<?php echo form_open('welcome/adminSignup',['class'=>'form-hoizontal']);?>
<h3 class="text-center display-4">ADMIN REGISTER</h3>
<hr/>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="row">
<div class="col-md-3">
<label for="username" class="mt-2">User name:</label>
</div>
<div class="col-md-9">
<!-- <input type="text" class="form-control" placeholder="User name" id="username"> -->
<?php
$data = array(
'type' => 'text',
'name' => 'username',
'placeholder' => 'Enter Username',
'class' => 'form-control'
);
echo form_input($data); ?>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<?php echo form_error('username','<div class="text-danger">','</div>');?>
</div>
</div><!--row-->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="row mt-3">
<div class="col-md-3">
<label for="email" class="mt-2">Email address:</label>
</div>
<div class="col-md-9">
<!-- <input type="email" class="form-control" placeholder="Enter email" id="email"> -->
<?php
$data = array(
'type' => 'email',
'name' => 'email',
'placeholder' => 'Enter Email',
'class' => 'form-control'
);
echo form_input($data); ?>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<?php echo form_error('email','<div class="text-danger">','</div>');?>
</div>
</div><!--row-->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="row mt-3">
<div class="col-md-3">
<label for="gender" class="mt-2">Gender:</label>
</div>
<div class="col-md-9">
<!-- <input type="email" class="form-control" placeholder="Enter email" id="email"> -->
<select class="form-control" name="gender">
<option>Select</option>
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<?php echo form_error('gender','<div class="text-danger">','</div>');?>
</div>
</div><!--row-->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="row mt-3">
<div class="col-md-3">
<label for="email" class="mt-2">Role:</label>
</div>
<div class="col-md-9">
<select class="form-control" name="role_id">
<option>Select</option>
<?php if(count($roles)) { ?>
<?php foreach ($roles as $role){?>
<option><?php echo $role->rolename;?></option>
<?php }
} ?>
</select>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<?php echo form_error('role_id','<div class="text-danger">','</div>');?>
</div>
</div><!--row-->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="row mt-3">
<div class="col-md-3">
<label for="password" class="mt-2">Password:</label>
</div>
<div class="col-md-9">
<!-- <input type="password" class="form-control" placeholder="Enter password" id="password"> -->
<?php
$data = array(
'type' => 'password',
'name' => 'password',
'placeholder' => 'Enter Password',
'class' => 'form-control'
);
echo form_input($data); ?>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<?php echo form_error('password','<div class="text-danger">','</div>');?>
</div>
</div><!--row-->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="row mt-3">
<div class="col-md-3">
<label for="password" class="mt-2">Password Again:</label>
</div>
<div class="col-md-9">
<!-- <input type="password" class="form-control" placeholder="Enter password" id="password"> -->
<?php
$data = array(
'type' => 'password',
'name' => 'confpwd',
'placeholder' => 'Enter Password Again',
'class' => 'form-control'
);
echo form_input($data); ?>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<?php echo form_error('confpwd','<div class="text-danger">','</div>');?>
</div>
</div><!--row-->
<div class="row">
<div class="col-md-6">
<!-- <button type="submit" class="btn btn-dark float-right">Register</button> -->
<div class="float-right">
<?php echo form_submit('Register', 'Register',"class='btn btn-dark'"); ?>
<?php echo anchor('welcome','GO BACK',['class'=>'btn btn-warning']);?>
</div>
</div>
</div>
<?php echo form_close(); ?>
</div>
<?php include('inc/footer.php');?>
here is screenshot

The errors are not showing because your select boxes are always submitting a value. When you select an option in the selectbox and no value attribute is specified, the value after the <option> tag is being sent to the server.
To trigger the required rule, you need to send an empty string.
To do this, you can either use an empty <option> tag for the placeholder:
<select class="form-control" name="gender">
<option></option>
<option>Male</option>
<option>Female</option>
</select>
Or set the value attribute of the placeholder to an empty string:
<select class="form-control" name="gender">
<option value="">Select</option>
<option>Male</option>
<option>Female</option>
</select>

Try below Code:
<select class="form-control" name="gender">
<option></option>
<option value="male">Male</option>
<option valie="female">Female</option>
</select>

Related

update in codeigniter 3, it's run but database didnt changed

i dont understand with my code. it's run, and work. but when i see in database didnt changed.
here's my controller, function perbarui for get id data, get the data id from model (MMobil).
public function perbarui($id = NULL){
$this->load->model('merek');
$this->load->library('form_validation');
$data['merk'] = $this->merek->getList();
$data['detail'] = $this->MMobil->detail($id);
$submit = $this->input->post('submit');
print_r($data);
if ($submit) {
$nomor_kendaraan = $this->input->post('nomor_kendaraan');
$nomor_mesin = $this->input->post('nomor_mesin');
$id_merek = $this->input->post('id_merek');
$tahun_beli = $this->input->post('tahun_beli');
$nama_mobil = $this->input->post('nama_mobil');
$this->form_validation->set_rules('nama_mobil', 'Nama_Mobil', 'required');
$this->form_validation->set_rules('nomor_kendaraan', 'Nomor_Kendaraan', 'required');
$data['detik'] = $this->MMobil->setData($nomor_kendaraan, $nomor_mesin, $id_merek, $tahun_beli, $nama_mobil);
if ($this->form_validation->run() == FALSE) {
$data['errors'] = TRUE;
}else{
$data['detail'] = $this->MMobil->detail($id);
print_r($data);
}
//redirect('Master');
}
$this->load->view('master-detail-mobil', $data);
}
here's my models. function setData for storage variable after click submit. function edit get id data and get variable arrayData from function setData
public function setData($nomor_kendaraan, $nomor_mesin, $id_merek, $tahun_beli, $nama_mobil){
$this->nomor_kendaraan = $nomor_kendaraan;
$this->nomor_mesin = $nomor_mesin;
$this->id_merek = $id_merek;
$this->tahun_beli = $tahun_beli;
$this->nama_mobil = $nama_mobil;
}
public function edit($id){
$arrayData = array(
'nomor_kendaraan' => $this->nomor_kendaraan,
'nomor_mesin' => $this->nomor_mesin,
'id_merek' => $this->id_merek,
'tahun_beli' => $this->tahun_beli,
'nama_mobil' => $this->nama_mobil,
);
$this->db->where('nomor_mesin', $id);
return $this->db->update($this->table,$arrayData);
}
here's my views
<?php $this->load->view('header.php'); ?>
<?php
echo"<h4>UPDATE DATA</h4>";
?>
<form class="form-horizontal" role="form" method="post" action="<?php echo site_url()?>/Master/perbarui/">
<div class="form-group">
<label class="control-label col-sm-2" for="noken">Nomor Kendaraan :</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="nomor_kendaraan" value="<?php
echo #$detail->nomor_kendaraan;
?>">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="nomes">Nomor Mesin :</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="nomor_mesin" value="<?php
echo #$detail->nomor_mesin;
?>">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="merk">Merek Mobil :</label>
<div class="col-sm-10">
<select class="form-control" name="id_merek">
<?php foreach ($merk as $mrk) :?>
<option value="<?php echo $mrk->id_merek ?>">
<?php
echo $mrk->nama_merek;
?>
</option>
<?php endforeach?>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="thn">Tahun Beli :</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="tahun_beli" value="<?php
echo #$detail->tahun_beli; ?>">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="namo">Nama Mobil :</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="nama_mobil" value="<?php
echo #$detail->nama_mobil; ?>">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="nomes"></label>
<div class="col-sm-2">
<input type="submit" class="form-control" name="submit" value="simpan">
</div>
</div>
</form>
<?php $this->load->view('footer.php'); ?>
and here my pictures before click submit and after click submit. i typed print_r for see the data array. if you see data array detail before click submit, there is data in detail. but after click submit data array detail gone.
enter image description here enter image description here

Codeigniter Cannot submit an ip adres on a form. Throws a Forbidden error

Here is my html form.
<?php echo form_open(base_url('admin/subeler/add'), 'class="form-horizontal"'); ?>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-5 form-control-label">
<label for="grup">Grup Adı</label>
</div>
<div class="col-lg-8 col-md-10 col-sm-8 col-xs-7">
<div class="form-group">
<div class="form-line">
<input type="text" id="grup" required name="grup" value="<?php echo set_value('grup'); ?>" class="form-control">
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-5 form-control-label">
<label for="name">Şube Adı</label>
</div>
<div class="col-lg-8 col-md-10 col-sm-8 col-xs-7">
<div class="form-group">
<div class="form-line">
<input type="text" id="name" required name="name" value="<?php echo set_value('name'); ?>"class="form-control">
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-5 form-control-label">
<label for="ip">İp Adresi</label>
</div>
<div class="col-lg-8 col-md-10 col-sm-8 col-xs-7">
<div class="form-group">
<div class="form-line">
<input type="text" id="ip" required name="ip" value="<?php echo set_value("ip"); ?>"class="form-control">
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-5 form-control-label">
<label for="path">Database Adı</label>
</div>
<div class="col-lg-8 col-md-10 col-sm-8 col-xs-7">
<div class="form-group">
<div class="form-line">
<input type="text" id="path" required name="path" value="<?php echo set_value('path'); ?>"class="form-control">
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-5 form-control-label">
<label for="lisans">Lisans Tarihi</label>
</div>
<div class="col-lg-8 col-md-10 col-sm-8 col-xs-7">
<div class="form-group">
<div class="form-line">
<input type="text" id="lisans" required name="lisans" value="<?php echo set_value('lisans'); ?>"class="form-control">
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-5 form-control-label">
<label for="il">İl</label>
</div>
<div class="col-lg-8 col-md-10 col-sm-8 col-xs-7">
<div class="form-group">
<div class="form-line">
<input type="text" id="il" name="il" value="<?php echo set_value('il'); ?>"class="form-control">
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-4 col-xs-5 form-control-label">
<label for="ilce">İlçe</label>
</div>
<div class="col-lg-8 col-md-10 col-sm-8 col-xs-7">
<div class="form-group">
<div class="form-line">
<input type="text" id="ilce" name="ilce" value="<?php echo set_value('ilce'); ?>"class="form-control">
</div>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-lg-offset-2 col-md-offset-2 col-sm-offset-4 col-xs-offset-5">
<input type="submit" name="submit" value="EKLE" class="btn btn-success m-t-15 waves-effect">
</div>
</div>
<?php echo form_close();?>
When I enter an ip adres to the input field like (http://xxx.xxx.xx.xx:xx/) redirect me to the 403 Forbidden page but when I put " (like "http://xxx.xxx.xx.xx:xx") to the ip adres it work fine. I tried to disable xss-filter disable in config files but result is same. Can anyone give some advice. How to submit an ip adres correctly with Codeigniter?
Server-Side
public function add()
{
if ($this->input->post("submit")) {
$this->form_validation->set_rules('grup', 'Grup Adı', 'trim|required');
$this->form_validation->set_rules('name', 'Şube Adı', 'trim|required');
$this->form_validation->set_rules('ip', 'İp Adresi', 'trim|required');
$this->form_validation->set_rules('path', 'Database Yolu', 'trim|required');
$this->form_validation->set_rules('lisans', 'Lisans Tarihi', 'trim|required');
if ($this->form_validation->run() == true) {
$data = array(
'name' => $this->input->post('name'),
'marka' => $this->input->post('grup'),
'ip' => $this->input->post('ip'),
'il' => $this->input->post('il'),
'ilce' => $this->input->post('ilce'),
'databasePath' => $this->input->post('path'),
'lisanse_date'=>$this->input->post('lisans')
);
$data = $this->security->xss_clean($data);
$result = $this->sube_model->add_sube($data);
if ($result) {
$this->session->set_flashdata('msg', 'Şube başarılı bir şekilde eklendi!');
redirect(base_url('admin/subeler'));
}
} else {
$data['view'] = 'admin/subeler/sube_ekle';
$this->load->view('layout', $data);
}
} else {
$data['view'] = 'admin/subeler/sube_ekle';
$this->load->view('layout', $data);
}
}
Unfortunately I could not test the code exactly as provided as I don't make use of CodeIgniter 3 anymore, so I translated it into CodeIgniter 4.
Also, I could not test what $this->sube_model->add_sube does.
This, plus the form view you provided is working when setting http://xx.xx.xx.xx:xx on every form field.
You should trace when the 403 forbidden is triggered.
If you make use of XDebug i'd recommend you to trace step by step where the execution fails.
Otherwise I'd just start removing code to find out at which point of the execution the exception is occurring.
If you are making use of a shared hosting, there could be any rule in the http server that is blocking the request, if that's the case, run it locally using a WAMP/LAMP bundle.
// CodeIgniter 4 approach
public function add() {
if ($this->request->getMethod() == 'post') {
$validation = \Config\Services::validation();
$validation->setRule('grup', 'Grup Adı', 'trim|required');
$validation->setRule('name', 'Şube Adı', 'trim|required');
$validation->setRule('ip', 'İp Adresi', 'trim|required');
$validation->setRule('path', 'Database Yolu', 'trim|required');
$validation->setRule('lisans', 'Lisans Tarihi', 'trim|required');
if ($validation->withRequest($this->request)->run() == true) {
$data = array(
'name' => $this->request->getPost('name'),
'marka' => $this->request->getPost('grup'),
'ip' => $this->request->getPost('ip'),
'il' => $this->request->getPost('il'),
'ilce' => $this->request->getPost('ilce'),
'databasePath' => $this->request->getPost('path'),
'lisanse_date'=>$this->request->getPost('lisans')
);
// $data = $this->security->xss_clean($data);
$result = $this->sube_model->add_sube($data);
$result = 1;
if ($result) {
session()->setFlashdata('msg', 'Şube başarılı bir şekilde eklendi!');
return redirect(base_url('admin/subeler'));
}
} else {
$data['view'] = 'admin/subeler/sube_ekle';
return view('layout', $data);
}
} else {
$data['view'] = 'admin/subeler/sube_ekle';
return view('layout', $data);
}
}

How to make textfield automatic field when dropdown is selected in codeigniter

Hallo i'm new in codeigniter, i want to make textinput filled after selected value of dropdown, can anyone give an example for me (for models, conntroller and view) ? thx
here is my dropdown form
<div class="form-group">
<?php $id = 'id="nama" class="form-control input-md" required';
echo form_dropdown('nama',$nama_cabang,'',$id)?>
<div class="invalid-feedback">
<?php echo form_error('nama_cabang') ?>
</div>
</div>
and its my textinput
<div class="form-group">
<input class="form-control <?php echo form_error('kode_cabang') ? 'is-invalid':'' ?>"
type="text" name="kode" placeholder="Kode Cabang" />
<div class="invalid-feedback">
<?php echo form_error('kode_cabang') ?>
</div>
</div>
how can the value of textinput changed when dropdown is selected.
You could use javascript onchange listener to set the trigger, and assign the text input with the current selected value using this.value :
<div class="form-group">
<?php $id = 'id="nama" class="form-control input-md" required onchange="document.getElementById(\'kodeCabang\').value = this.value"';
echo form_dropdown('nama',$nama_cabang,'',$id)?>
<div class="invalid-feedback">
<?php echo form_error('nama_cabang') ?>
</div>
</div>
And add an id attribute (id="kodeCabang") to set the target element :
<div class="form-group">
<input class="form-control <?php echo form_error('kode_cabang') ? 'is-invalid':'' ?>" id="kodeCabang"
type="text" name="kode" placeholder="Kode Cabang" />
<div class="invalid-feedback">
<?php echo form_error('kode_cabang') ?>
</div>
</div>

Laravel REST API generating 500 internal server error during inserting data from controller to model

I have created a REST API for inserting data from Modal. After submitting my form I get data from my "store" controller. But when I call a Model function to insert that data to Database then I am getting 500 internal server error at console.
I have tried with two ways 1. Using Eloquent ORM
2. Using Query Builder
My controller:
public function store(Request $request)
{
$category_name = $request->category_name;
$category_entry_date = $request->category_entry_date;
$category_info = array(
'Supplier_Name' => $category_name,
'Supplier_Des' => $category_entry_date,
'Shop_Id' => 1
);
// Insert data into database
Product::CreateProductCategory($category_info);
return response()->json(['success_massege'=>'Category Added Successfully']);
}
Js:
$("#category_submit").click(function (e) {
event.preventDefault();
var category_name = $('#category_name_id').val();
var category_entry_date = $('#category_entry_date_id').val();
if (category_name && category_entry_date) {
$.post("/api/api/product_category", {category_name: category_name, category_entry_date: category_entry_date}).done(function (data) {
$('#category_name_id').val("");
$('#category_entry_date_id').val("");
var success_massege_dialogbox = '';
success_massege_dialogbox += '<div class="alert alert-success fade in">';
success_massege_dialogbox += '×';
success_massege_dialogbox += '<strong>Success!</strong>' + data.success_massege + '</div>';
$('#success_massege').append(success_massege_dialogbox);
});
}
else {
alert('Please give a category name and entry date');
}
});
Model:
static function CreateProductCategory($category_info){
DB::table('product_category_info')->insert($category_info);
}
View:
<div class="modal fade" id="addCategory" tabindex="-1" role="dialog" aria-labelledby="addCategoryLabel">
<div class="modal-dialog" role="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="addCategoryLabel">Add Category</h4>
</div>
<form action="{{ route('product_category.store') }}" method="POST">
<div class="modal-body">
<div class="modal-body">
<div class="box-body">
<div class="row form-group">
<div class="col-md-3 form-level"></div>
<div class="col-md-9" id="success_massege"> </div>
</div>
<div class="row form-group">
<div class="col-md-3 form-level"><label>Category Name<b class="mandetory_star">*</b></label></div>
<div class="col-md-9" id="email-error-dialog">
{{Form::text('category_name','', $attributes = array('class' => 'form-control',
'id' => 'category_name_id',
'data-validation'=>'alphanumeric', 'data-validation-allowing'=>'-_',
'data-validation-error-msg'=>'Please Enter a Valid Category Name',
'data-validation-error-msg-container'=>'#email-error-dialog',
))}}
</div>
</div>
<div class="row form-group">
<div class="col-md-3 form-level"><label>Entry Date<b class="mandetory_star">*</b></label></div>
<div class="col-md-9" id="date-error-dialog">
{{Form::date('entry_date','', $attributes = array('class' => 'form-control',
'id' => 'category_entry_date_id',
'data-validation'=>'date',
'data-validation-error-msg'=>'Please Enter a Valid Date',
'data-validation-error-msg-container'=>'#date-error-dialog'))}}
</div>
</div>
</div><!-- /.box-body -->
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button id="category_submit" type="submit" class="btn btn-primary save-category"> Save category </button>
</div>
</form>
</div>
</div>
</div>

Form submit, Input:all() not showing all inputs

RESTfully, When I submit my form and return Input:all() in the Store method I'm getting only couple inputs not all of them!!
Can anyone help me here to find out why?
and advise me if I've to use Ajax all the time to submit forms, With example please!
Store method in the Controller:
/**
* Store a newly created HOTEL in DB.
*
* #return Response
*/
public function store(/*AddNewHotelRequest $addNewHotelRequest*/)
{
if(Request::ajax()) {
if ( Session::token() !== Input::get( '_token' ) ) {
return Response::json( array(
'msg' => 'Unauthorized attempt to create setting'
) );
}
$input = Request::all();
$response = [
'status' => 'success',
'input' => $input,
'msg' => 'Hotel created successfully',
];
return Response::json( $response );
}
// return Input::all(); //with Request::all() same output
}
Form from view "create new hotel"
{!! Form::open([ 'data-remote' ,'method'=>'POST', 'action' => 'HotelsController#store', 'class' => 'panel form-horizontal','id'=>'hotelForm']) !!}
<input id="myToken" type="hidden" name="_token" value="{{ csrf_token() }}" />
<script> var _CSRT_token = "{{ csrf_token() }} " ;</script>
<div class="panel-heading">
<span class="panel-title">Adding New Hotel</span>
</div>
<div class="panel-body">
<!-- / .form-group of Errors -->
<div class="form-group">
<div class="col-sm-12">
#include('errors.list')
</div>
</div>
<!-- Hotel Name -->
<div class="form-group">
<label for="hotel_name" class="col-sm-2 control-label">Hotel name *</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="hotel_name" name="hotel_name" placeholder="Hotel name">
</div>
<p class="label label-warning label-tag">Name should be in English</p>
</div>
<!-- / .form-group of hotel_details -->
<div class="form-group">
<label for="hotel_details" class="col-sm-2 control-label">Hotel Details</label>
<div class="col-sm-8">
<textarea class="form-control" id="hotel_details" placeholder="Short description, General information or Some Details about this Hotel" rows="3"></textarea>
</div>
<p class="label label-warning label-tag">Details should be in English</p>
</div>
<!-- Hotel website -->
<div class="form-group">
<label for="hotel_website" class="col-sm-2 control-label">Website *</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="hotel_website" name="hotel_website" placeholder="http://">
</div>
</div>
<!-- / .form-group of rank -->
<div class="form-group">
<label for="rank" class="col-sm-2 control-label">Rank</label>
<div class="col-sm-1">
<input type="text" class="form-control" id="rank" placeholder="Boutique or 4">
</div>
</div>
<div class="panel colourable">
<div class="panel-body">Prices</div>
<!-- / .form-group of single_price -->
<div class="form-group">
<label for="single_price" class="col-sm-2 control-label">Single price</label>
<div class="input-group col-sm-1">
<span class="input-group-addon">€</span>
<input type="text" class="form-control room-price-group" id="single_price">
<span class="input-group-addon">.00</span>
</div>
</div>
<!-- / .form-group of double_price -->
<div class="form-group">
<label for="double_price" class="col-sm-2 control-label">Double price</label>
<div class="input-group col-sm-1">
<span class="input-group-addon">€</span>
<input type="text" class="form-control room-price-group" id="double_price">
<span class="input-group-addon">.00</span>
</div>
</div>
<!-- / .form-group of extra_bed_price -->
<div class="form-group">
<label for="extra_bed_price" class="col-sm-2 control-label">Extra Bed price</label>
<div class="input-group col-sm-1">
<span class="input-group-addon">€</span>
<input type="text" class="form-control" id="extra_bed_price">
<span class="input-group-addon">.00</span>
</div>
</div>
</div>
<div class="form-group">
<label for="facilities" class="col-sm-2 control-label">Facilities *</label>
<div class="col-sm-10">
<select id="facilities" class="col-sm-8 form-controljs-example-basic-multiple" name="facilities" multiple="multiple">
<optgroup label="Free">
#foreach($facilities as $facility)
#if(!$facility->is_surcharge)
<option class="" value="{{ $facility->id }}">{{ $facility->name }}</option>
#endif
#endforeach
</optgroup>
<optgroup label="Surcharge">
#foreach($facilities as $facility)
#if($facility->is_surcharge)
<option value="{{ $facility->id }}">{{ $facility->name }}</option>
#endif
#endforeach
</optgroup>
</select>
</div>
</div>
<div class="panel colourable">
<div class="panel-body">Address</div>
<!-- / .form-group of Country -->
<div class="form-group">
<label for="country" class="col-sm-2 control-label">Country *</label>
<div class="col-sm-2">
<select id="country" class="form-control" name="country" >
<option></option>
#foreach($countries as $country)
<option value="{{ $country->id }}" phone_code="{{ $country->phone_code }}" >{{ $country->name }}</option>
#endforeach
</select>
<p class="help-block helperQuote">Begin by choosing your country.</p>
</div>
</div>
<!-- / .form-group of Region -->
<div class="form-group">
<label for="region" class="col-sm-2 control-label">Region *</label>
<div class="col-sm-2">
<select id="region" class="form-control" name="region">
</select>
</div>
</div>
<!-- / .form-group of city -->
<div class="form-group">
<label for="city" class="col-sm-2 control-label">City *</label>
<div class="col-sm-2">
<select id="city" class="form-control" name="city">
</select>
</div>
</div>
<!-- / .form-group of rank -->
<div class="form-group">
<label for="zip" class="col-sm-2 control-label">Zip Code</label>
<div class="col-sm-1">
<input type="text" class="form-control" id="zip" placeholder="34600">
</div>
</div>
<!-- / .form-group of city -->
<div class="form-group">
<label for="address" class="col-sm-2 control-label">Hotel Address *</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="address" placeholder="Street name, number of building floor ...etc">
</div>
{{--<p class="label label-warning label-tag">Address should be in English</p>--}}
</div>
<!-- / .form-group of map -->
{{--GOOGLE MAPS--}}
<div class="form-group">
<label for="map" class="col-sm-2 control-label">Location *</label>
{{--Initialize Map--}}
<div class="col-sm-9">
<div id="map-canvas" class="" style="width: 100%; height: 350px !important;">
</div>
<p id="markerPosition" class="help-block"><i>Drag the pin to the position of the hotel </i></p>
<p id="lat" class="help-block">Latitude: 41.0694</p>
<p id="lng" class="help-block">Longitude: 29.0043</p>
<input id="latitude" type="hidden" value="37.7577">
<input id="longitude" type="hidden" value="-122.4376">
</div>
</div>
</div> <!-- End of Address Panel -->
<!-- Hotel tel -->
<div class="form-group">
<label for="country_code" class="col-sm-2 control-label">Country Code *</label>
<div class="col-sm-1">
<input type="text" class="form-control" id="country_code" name="country_code" placeholder="+90">
</div>
<label for="country_code" class="col-sm-1 control-label">Phone *</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="phone" name="phone" placeholder="(___) ___-____">
</div>
<label for="extension" class="col-sm-1 control-label">Extension</label>
<div class="col-sm-1">
<input type="text" class="form-control" id="extension" name="extension" placeholder="3">
</div>
</div>
<ht/>
<!-- / .form-group of status -->
<div class="form-group">
<label for="status" class="col-sm-2 control-label">Status *</label>
<div class="col-sm-2">
<select id="status" class="form-control" name="status" >
<option value="0">Suspended</option>
<option value="1" selected>Draft</option>
<option value="2">Published</option>
</select>
<p class="help-block helperQuote"><strong>Suspended:</strong>Trash,<strong>Draft:</strong>Default,<strong>Published:Online</strong></p>
</div>
<p class="label label-warning label-tag">Only Published Hotels will be online!</p>
</div>
{{--#if (Auth::user()->isAdmin())--}}
<!-- / .form-group of publisher -->
<div class="form-group">
<label for="publisher" class="col-sm-2 control-label">Publisher *</label>
<div class="col-sm-2">
<select id="publisher" class="form-control" name="publisher" >
#foreach($publishers as $publisher)
<option value="{{ $publisher->id }}">{{ $publisher->name }} ({{$publisher->type}}) </option>
#endforeach
</select>
</div>
</div>
{{--#endif--}}
<div class="form-group" style="margin-bottom: 0;">
<div class="col-sm-offset-2 col-sm-1">
<button type="submit" class="btn btn-lg btn-primary btn-flat"><span class="btn-label icon fa fa-plus-circle"></span> Add Hotel</button>
</div>
<div id="loader" class="col-sm-1" style="display: none;"><img src="/assets/images/plugins/bootstrap-editable/loading.gif" alt="loading regions" /></div>
</div> <!-- / .form-group -->
</div>
{!! Form::Close() !!}
The output is like this:
{"_token":"PWKknjx5S9u8m98ApGDXYKqaTyF7aFZDaye9uYPm","hotel_name":"City Loft","hotel_website":"http:\/\/www.cityloft.com.tr\/","facilities":"23","country":"6","region":"3344950","city":"783593","country_code":"+355","phone":"(123) 123-1231","extension":"3123","status":"1","publisher":"1"}
you forgot name attribute for Hotel Detail and Price and might be more
<textarea class="form-control" **name="hotel_detail"** id="hotel_details" placeholder="Short description, General information or Some Details about this Hotel" rows="3"></textarea>