Codeigniter post requests redirect to home page - codeigniter

Here I am trying to debug someone else's codeigniter application, I realized that all post requests are redirecting to the homepage (base url) without throwing any error message. what could be the cause of this and how do i get around this. thanks in advance.. Lacasera
<form action="controller/method" method="post" accept-charset="utf-8">
<input type="hidden" name="csrf_test_name" value="9881e8cd803cb06baccb4aafbeb51d70" style="display:none;" />
<div class="form-group mb-lg">
<label>Email</label>
<div class="input-group input-group-icon">
<input tabindex="1" autofocus name="uname" type="email" class="form-control input-lg" />
<span class="input-group-addon">
<span class="icon icon-lg">
<i class="fa fa-envelope-o"></i>
</span>
</span>
</div>
</div>
<div class="form-group mb-lg">
<div class="clearfix">
<label class="pull-left">Password</label>
Lost Password?
</div>
<div class="input-group input-group-icon">
<input tabindex="2" name="password" type="password" class="form-control input-lg" />
<span class="input-group-addon">
<span class="icon icon-lg">
<i class="fa fa-lock"></i>
</span>
</span>
</div>
</div>
<div class="row">
<div class="col-sm-12 text-right">
<button type="submit" class="btn btn-success btn-block btn-lg hidden-xs">Sign In <i class="fa fa-sign-in"></i>
</button>
<button type="submit" class="btn btn-success btn-block btn-lg visible-xs mt-lg"><i class="fa fa-sign-in"></i> Sign In</button>
</div>
</div>
<p class="text-center">Don't have an account yet? Sign Up!
</div>
</div>

change the first line
echo form_open(base_url('index.php/your_controller/'), $attributes);
/**code into the form*/
echo form_close()

First of load url helper in your controller constructor as follows:
function __construct()
{
$this->load->helper('url');
}
Then submit form like this...
<form action="<?php echo base_url('controller_name/method_name'); ?>" method="post" accept-charset="utf-8">
<input type="hidden" name="csrf_test_name" value="9881e8cd803cb06baccb4aafbeb51d70" style="display:none;" />
<div class="form-group mb-lg">
<label>Email</label>
<div class="input-group input-group-icon">
<input tabindex="1" autofocus name="uname" type="email" class="form-control input-lg" />
<span class="input-group-addon">
<span class="icon icon-lg">
<i class="fa fa-envelope-o"></i>
</span>
</span>
</div>
</div>
<div class="form-group mb-lg">
<div class="clearfix">
<label class="pull-left">Password</label>
Lost Password?
</div>
<div class="input-group input-group-icon">
<input tabindex="2" name="password" type="password" class="form-control input-lg" />
<span class="input-group-addon">
<span class="icon icon-lg">
<i class="fa fa-lock"></i>
</span>
</span>
</div>
</div>
<div class="row">
<div class="col-sm-12 text-right">
<button type="submit" class="btn btn-success btn-block btn-lg hidden-xs">Sign In <i class="fa fa-sign-in"></i>
</button>
<button type="submit" class="btn btn-success btn-block btn-lg visible-xs mt-lg"><i class="fa fa-sign-in"></i> Sign In</button>
</div>
</div>
<p class="text-center">Don't have an account yet? Sign Up!</p><
</form>

Related

My form doesn't submit in livewire project

I'm learning Livewire framework by an online course and in order to learning I created a test project.
in a part of this project I've a form that doesn't submit and the view refreshes but apparently there is nothing wrong with codes .
and it's necessarily that I point after clicking the submit button and refreshing ' a ? add to URL.
http://127.0.0.1:8000/auth?
My form:
<form wire:submit.prevent="register">
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"> <i class="fa fa-user"></i> </span>
</div>
<input wire:model.lazy='name' class="form-control" placeholder="Full name" type="text">
</div> <!-- form-group// -->
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"> <i class="fa fa-envelope"></i> </span>
</div>
<input wire:model.lazy='email' class="form-control" placeholder="Email address" type="email">
</div> <!-- form-group// -->
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"> <i class="fa fa-lock"></i> </span>
</div>
<input wire:model.lazy='password' class="form-control" placeholder="Create password" type="password">
</div> <!-- form-group// -->
<div class="form-group input-group">
<div class="input-group-prepend">
<span class="input-group-text"> <i class="fa fa-lock"></i> </span>
</div>
<input wire:model.lazy='ConfirmPassword' class="form-control" placeholder="Repeat password" type="password">
</div> <!-- form-group// -->
<div class="form-group">
<button class="btn btn-primary" type="submit" >
create account
<div wire:loading>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
</div>
</button>
</div>
</form>
My component:
class Register extends Component
{
public $name,$email,$password,$ConfirmPassword;
public function register(){
dd('dul');
$this->validate([
'name'=>'required|string',
'email'=>'required|email|unique:users,email',
'password'=>'required|string|min:8|same:ConfirmPassword',
]);
User::create([
'user'=>$this->name,
'email'=>$this->email,
'password'=>Hash::make($this->password),
]);
session()->flash('success','registration done successfuly');
}
public function render()
{
return view('livewire.auth.register');
}
}
My routes:
<?php
use App\Http\Livewire\Post\Index as INdexPost;
use App\Http\Livewire\Auth\Index as IndexAuth;
use App\Http\Livewire\Auth\Register ;
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
return view('index');
});
Route::get('/post', IndexPost::class);
Route::get('/auth', IndexAuth::class);
Check your in blade root element, If there is more than one root element, post method instead of get method works.
https://laravel-livewire.com/docs/2.x/troubleshooting#root-element-issues

how to validate Unique database field on Controller in laravel

Good Day, I am new in Laravel environment. I am developing a simple school enrollment registration website but having trouble in validation on my controller..
My plan is, when the user will register in the website, username textbox should be validated if the username is already used by other student. i tried every possible tutorial i found in the net but i have no luck...
Here is my page, red circle should be validated if the input username already exist in the database..
Whole code in .blade
<!--Registration start here -->
<form method="Post" action="{{url('store_account_Registration')}}">
#csrf
#if(Session::get('success'))
<div class="alert alert-danger">
{{ Session::get('success')}}
</div>
#endif
#if(Session::get('fail'))
<div class="alert alert-danger">
{{ Session::get('fail')}}
</div>
#endif
<div class="col-sm-12 form-group">
<input type="hidden" class="form-control" name="uniqID3" id="uid" placeholder="Enrollment Registration Number" value="{{ $regid3 }}" >
</div>
<div class="col-sm-12 form-group">
<input type="hidden" class="form-control" name="pfulname3" id="name-f" placeholder="Enrollment Registration Number" required value="{{ $fulname4 }}" >
</div>
<div class="container-fluid" style="margin-bottom: 2em">
<div class="row justify-content-center align-items-center" style="padding: 10px">
<div class="card col-md-5" style="transform: none;>
<div class="card-body">
<div class="alert alert-primary" role="alert" style="margin-top: 1em">
<p>Name: <strong>{{ $fulname4 }}</strong></p>
<p>Enrollment No.: <strong>{{ $regid3 }}</strong></p>
</div>
<input type="hidden" class="hide" id="csrf_token" name="csrf_token" value="C8nPqbqTxzcML7Hw0jLRu41ry5b9a10a0e2bc2">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Username</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-user" aria-hidden="true"></i></span>
</div>
<input type="text" class="form-control" name="username" id="username" placeholder="Username" required value="{{ old('username')}}" >
</div>
<div class="help-block with-errors text-danger">
<span style="color:red">#error('username'){{ $message}}#enderror</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Password</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-lock" aria-hidden="true"></i></span>
</div>
<input type="password" id="password" name="password" pattern="^\S{6,}$" onchange="this.setCustomValidity(this.validity.patternMismatch ? 'Must have at least 6 characters' : ''); if(this.checkValidity()) form.password_two.pattern = this.value;" class="form-control" title="Password is needed" required placeholder="Password" >
</div>
<div class="help-block with-errors text-danger">
<span style="color:red">#error('password'){{ $message}}#enderror</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Confirm Password</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-lock" aria-hidden="true"></i></span>
</div>
<input id="password_two" type="password" name="password_two" pattern="^\S{6,}$" onchange="this.setCustomValidity(this.validity.patternMismatch ? 'Please enter the same Password as above' : '');" placeholder="Confirm Password" class="form-control" title="Confirm Password is needed" required placeholder="Confirm Password" >
</div>
<div class="help-block with-errors text-danger">
<span style="color:red">#error('password_two'){{ $message}}#enderror</span>
</div>
</div>
</div>
</div>
<div class="row" style="margin-top: 1em" >
<div class="col-md-12" style="margin-bottom: 2em">
<input type="hidden" name="redirect" value="">
<!-- <button type="submit" class="btn btn-primary btn-lg btn-block" name="submit">Save OASIS Account</button> -->
<!-- < <p class="btn btn-primary btn-lg btn-block">Save OASIS Account</p> -->
<button type="submit" class="btn btn-primary btn-lg btn-block">Save OASIS Account</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!--Registration start here -->
</div>
</form>
enter code here
I always got this error..
Here is my code..
my validation in my controller
public function store_account_Registration(Request $request)
{
request()->validate([
'username' => 'required|min:6|unique:TempAccount,AccountName,'
]);
// $this->validator($request->all())->validate();
$current_date = date('Y-m-d H:i:s');
$query = DB::table('TempAccount')->insert([
'RegID'=>$request->input('uniqID3'),
'FullName'=>$request->input('pfulname3'),
'AccountName'=>$request->input('username'),
'Pass'=>$request->input('password'),
'created_at'=> $current_date,
'updated_at'=> $current_date,
]);
if($query){
return back()->with('success', 'Data has been Successfyll inserted');
// return view('pages.enrollment_success');
// return redirect()->route('pages.enrollment_GradeLevelSchoolInfo', ['uniqIDd' => 1]);
// return redirect('enrollment_GradeLevelSchoolInfo');
}
else
{
return back()->with('fail', 'something went wrong');
}
}
my Route in web.php
Route::get('pages',[accountregistration::class, 'index']);
Route::Post('store_account_Registration', [accountregistration::class, 'store_account_Registration']);
my action in form..
The issue is in your form. You are not reaching the correct route at all.
Also you are missing the #csrf token or at least not shown in your print screen
<form action="{{url('store_account_Registration')}}" method="POST">
#csrf
In your validation you can remove the trailing coma after AccountName as well.

Laravel: cascading model login and registration using bootstrap

I am trying to make a cascaded login and registration model using bootstrap.
when I click on sign in button the model pop up which is fine but login field is not working. Registration button is working. Again click on Login button the fields appear. Here is the screenshots and code
<a href="#" class="nav-link" data-toggle="modal" data-target="#exampleModal">
<img src="public/img/sign-in-icon.png" class="img-sign-in img-responsive"></a></li>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<!-- Nav tabs -->
<ul class="nav nav-tabs md-tabs tabs-2">
<li class="active">
<a class="nav-link active" data-toggle="tab" href="#login-form" role="tab"><i class="fas fa-user mr-1"></i>
Login</a>
</li>
<li>
<a class="nav-link" data-toggle="tab" href="#registration-form" role="tab"><i class="fas fa-user-plus mr-1"></i>
Register</a>
</li>
</ul>
<!--
<li class="nav-item">
Register
</li> -->
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="tab-content">
<div id="login-form" class="tab-pane fade in active">
<form method="POST" action="{{ route('login') }}">
#csrf
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control #error('email') is-invalid #enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
#error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control #error('password') is-invalid #enderror" name="password" required autocomplete="current-password">
#error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group row">
<div class="col-md-6 offset-md-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="remember">
{{ __('Remember Me') }}
</label>
</div>
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Login') }}
</button>
#if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
#endif
</div>
</div>
</form>
</div>
<div id="registration-form" class="tab-pane fade">
<form action="/">
<div class="form-group">
<label for="name">Your Name:</label>
<input type="text" class="form-control" id="name" placeholder="Enter your name" name="name">
</div>
<div class="form-group">
<label for="newemail">Email:</label>
<input type="email" class="form-control" id="newemail" placeholder="Enter new email" name="newemail">
</div>
<div class="form-group">
<label for="newpwd">Password:</label>
<input type="password" class="form-control" id="newpwd" placeholder="New password" name="newpwd">
</div>
<button type="submit" class="btn btn-default">Register</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
Does anybody please know, what is wrong with the code?

how to send data from the view to the controller In laravel

I'm doing a web application, and I get to a point where I can not move forward, I do not know how to do this, I'm starting with laravel so maybe the solution is very simple:
public function detalle($id){
// $nota = App\Nota::find($id);
//Aquí valida si existe sino redirije al 404
$producto = App\Producto::findOrFail($id);
$cantidad = 1;
return view('productos.detalle', compact('producto','cantidad'));
}
View:
<div class="card col-6 ">
<div class="card-body card-buy">
<h1 class="display-4 ">{{$producto->nombre}}</h1>
<p class="h3 mt-5">S/ {{$producto->precio}}</p>
<div class="form-inline">
<i class="fas fa-credit-card h1 mr-1"></i>
<p class="mt-2 "> <b>Metodo de pago:</b> A convenir</p>
</div>
<div class="form-inline">
<i class="fab fa-mailchimp ml-2 mr-2 h1"></i>
<p class="mt-2 "> <b>Envio:</b> Disponible a todo el pais</p>
</div>
<div class="form-inline ">
<div class="mt-n5 mr-2">
<b>Cantidad:</b>
</div>
<div class="def-number-input number-input safari_only">
<button onclick="this.parentNode.querySelector('input[type=number]').stepDown()" class="minus"></button>
<input readonly="readonly" class="quantity" min="1" max="{{$producto->stock}}" name="quantity" value="{{$cantidad}}" type="number">
<button onclick="this.parentNode.querySelector('input[type=number]').stepUp()" class="plus"></button>
</div>
<div class="mt-n5 ml-2">
<b class="text-decoration-none"> ( {{$producto->stock}} disponibles)</b>
</div>
</div>
Comprar
</div>
</div>
https://gyazo.com/febcd4c38cb3ef244e7424a3d92079a4
I already created the detail view of my product, and I put a button for the user to select the amount of products he wants, until there is everything right ...
But I want that number that the person chose to go to the next view, which is to confirm
https://gyazo.com/f56cf578808e75a0fab25eeffa8d2c5d
but that data {{$cantidad}} I do not know how to pass it to this new view I put the code:
Controller:
public function detallescompra($id){
$producto = App\Producto::findOrFail($id);
$total = 0;
$num1 = $producto->precio;
$num2 = $producto->stock;
$total = $num1 * $num2;
return view('productos.compra', compact('producto','total'));
}
and in the view:
<div class="container">
<div class="row" id="contenido">
<div class="col-md-8">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<span>Revisa y Confirma</span>
Seguir viendo...
</div>
<div class="card-body">
#if ( session('mensaje') )
<div class="alert alert-success">{{ session('mensaje') }}</div>
#endif
<form method="POST" action="{{ route ('productos.comprafinal') }}">
#csrf
<label class="text-gray">Contacto y Envio:</label>
<div id="contenido">
<input type="name" name="usuario" placeholder="Nombre y Apellido" class="form-control mb-2" required />
<input type="email" name="email" placeholder="Email de contacto" class="form-control mb-2" required />
<input type="number" name="tlf" placeholder="Numero de telefono" class="form-control mb-2" />
<input type="street-address" name="direccion" placeholder="Direccion (Calle - #Casa - Referencia)" class="form-control mb-2" validate required />
<input type="text" name="id" placeholder="" class="form-control mb-2 d-none" value="{{$producto->id}}" />
<input type="text" name="timestamps" placeholder="" class="form-control mb-2 d-none" value="{{$producto->timestamp}}" />
<label class="text-gray">Producto:</label>
<input type="text" name="nombre" placeholder="Precio del Producto" class="form-control mb-2" value="{{$producto->nombre}}" readonly="readonly" />
<input type="text" name="precio" placeholder="Precio del Producto" class="form-control mb-2" value="Precio por unidad: S/ {{$producto->precio}}" readonly="readonly" id="valor1" />
<input type="text" name="cantidad" placeholder="Precio del Producto" class="form-control mb-2" value="Numero de productos: " readonly="readonly" id="valor2" />
<input type="text" name="" placeholder="Precio del Producto" class="form-control mb-2" value="Total a pagar: S/ {{$total}}" readonly="readonly" id="total" />
<button class="btn btn-success btn-block" type="submit">Comprar</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-mod-4">
<div class="card" style="width: 18rem;">
<img src="{{$producto->img}}" class="card-img-top" alt="...">
</div>
</div>
</div>
I just need to spend that {{$cantidad}} in my view productos.compra, So far I have tried many things but nothing has given me even the minimum result
I'm new to this, I need help :(
GG :D
public function detallescompra(Request $request,$id){
$producto = App\Producto::findOrFail($id);
$cantidad = $request->input('cantidad');
$total = 0;
$num1 = $producto->precio;
$num2 = $cantidad;
$total = $num1 * $num2;
return view('productos.compra', compact('producto','total','cantidad'));
}
View:
<form action="{{ route('productos.compra-confirm', $producto) }}" method="POST">
#csrf
<div class="form-inline ">
<div class="mt-n5 mr-2">
<b>Cantidad:</b>
</div>
<div class="def-number-input number-input safari_only">
<button type="button" onclick="this.parentNode.querySelector('input[type=number]').stepDown()" class="minus"></button>
<input readonly="readonly" class="quantity" min="1" max="{{$producto->stock}}" name="cantidad" value="{{$cantidad}}" type="number">
<button type="button" onclick="this.parentNode.querySelector('input[type=number]').stepUp()" class="plus"></button>
</div>
<div class="mt-n5 ml-2">
<b class="text-decoration-none"> ( {{$producto->stock}} disponibles)</b>
</div>
</div>
<button type="submit" class=" align-bottom btn btn-success btn-lg btn-block ">Comprar</button>
</div>
</div>
</form>
routes web:
Route::post('/comprar/{id}', 'HomeController#detallescompra')->name('productos.compra-confirm');

How to ' pass concatenated parameters as single parameter and populate the view page'?

I have tried and got help from stack overflow kind team member and reached till this level, yet I have to go step closer to solve it .However, when
I am trying to pass parameter that is concatenated, example I pass parameter like l/59. Once this parameter is passed, it should retrieve relevant data from table named st_dak_details , and I want data retrieved from that table to populate it in another view page . But it is not working, meaning not getting populated.
first view page where I pass parameter
<div class="col-sm-7 col-md-6 col-lg-4">
<button type="reset" class="btn btn-default" >Reset <span class="glyphicon glyphicon-refresh"></span></button>
<button type="button" class="btn btn-success" id="getbtn" onclick="loadPagcontente('<?php echo site_url()?>/UsermanagementController/forwardtrack')" >Get Detais <span class="glyphicon glyphicon-ok"></span></button>
<!-- <button type="button" class="btn btn-success" id="getbtn" onclick="loadPagcontente('<?php //echo site_url()?>/UsermanagementController/forwardtrack')">Get Detais <span class="glyphicon glyphicon-ok"></span></button> -->
</div>
Inside Controller
function forwardtrack($param='',$param2='') {
if(sizeof($this->db->get_where('st_forward',array('letter_no' =>$param.'/'.$param2))->result_array())>0 && (!($param.'/'.$param2) )){
$data1['message']= 'notallow';
$this->load->view('track1',$data1);
}else{
$data1['name']=$this->db->get_where('bpas_user_profiles',array('AgencyMainParentID' =>$this->session->userdata('ministryId'),'AgencyParentID'=>$this->session->userdata('parentID'),'AgencyID'=>$this->session->userdata('agencyID')))->result_array();
$data1['userdeatils']=$this->ag->tracks($param.'/'.$param2);
$this->load->view('userManagement/forward2', $data1);
}
/* ag=> agency model */
}
Inside model
public function tracks($letterno="")
{
$query= $this->db->get_where('st_dak_details',array('dakLetterNo'=>$letterno));
if ($query->num_rows() > 0) {
return $query->row();
} else {
return array();
}
}
Inside final view page
<div class="container">
<div class="panel panel-info">
<div class="panel-heading">
<i class="fa fa-envelope-o fa-fw"></i>forward to
</div>
<div class="panel-body">
<form class="form-horizontal" enctype="multipart/form-data" action="#" method="post" id="forwardmessage">
<div class="form-group">
<label for="letter"class="col-xs-12 col-lg-1 col-sm-1 col-md-1">letter_no: </label>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
<?php if(!empty($userdeatils)){
foreach($userdeatils as $row) { ?>
<!-- your html code -->
<input name="dakLetterNo" id="dakLetterNo" value="<?php echo $row['dakLetterNo'];?>"readonly="true" class="form-control" type="text" required />
</div>
</div>
<!-- <div class="form-group">
<label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">created: </label>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
<input name="copy_to" id="copy_to" value="<?php //echo $userdeatils->created;?>"readonly="true" class="form-control" type="text" required />
</div> -->
<div class="form-group">
<label class="col-xs-12 col-lg-2 col-sm-2 col-md-2 control-label">Attachment: </label>
<div class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
<input type="file" name="Attachment" id="Attachment">
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">Subject: </label>
<div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
<span class="input-group-addon" id="subjecterr"><i class="glyphicon glyphicon-credit-card"></i></span>
<input name="subject" id="Remark" value="<?php echo $row['Remark'];?>"readonly="true" class="form-control" type="text" required />
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">Place: </label>
<div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
<span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
<input name="place" id="place" value="<?php echo $row['place'];?>"readonly="true" class="form-control" type="text" required />
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">from: </label>
<div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
<span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
<input name="from" id="receieve_add" value="<?php echo $row['receieve_add'];?>"readonly="true" class="form-control" type="text" required />
</div>
</div>
<div class="form-group">
<label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">Created: </label>
<div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
<span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span>
<input name="created" id="created" value="<?php echo $row['created'];?>"readonly="true" class="form-control" type="text" required />
</div>
</div>
<!-- </div> -->
<!-- <div class="form-group"> -->
<!-- <label class="col-xs-12 col-lg-2 col-sm-2 col-md-2">Message: </label> -->
<!-- <div class="input-group" class="col-xs-12 col-lg-10 col-sm-10 col-md-10"> -->
<!-- <span class="input-group-addon"><i class="glyphicon glyphicon-credit-card"></i></span> -->
<!-- <input name="message" id="message" value="<?php //echo $userdeatils->created;?>"readonly="true" class="form-control" type="text" required /> -->
<!-- </div> -->
<!-- </div> -->
<?php } ?> <!-- //foreach close -->
<?php } ?> <!-- //if close -->
<div class="form-group">
<label class="col-lg-2 col-xs-12 col-sm-2 col-md-2">Message: </label>
<div class="col-xs-12 col-lg-10 col-sm-10 col-md-10">
<textarea class="form-control" id="message" name="message"></textarea>
<span id="messageerr" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 col-xs-12 col-sm-2 col-md-2">
Forward to
</label>
<div class="col-lg-6 col-xs-12 col-sm-6 col-md-6">
<select name="forwardto[]" id="agency" class="form-control">
<option value="">Select</option>
<?php
foreach($name as $row): ?>
<option value="<?php echo $row['cid']?>">
<?php echo $row['FirstName'].$row['MiddleName'].$row['LastName']?>
</option>
<?php endforeach;?>
</select>
<span id="forwarderr" class="text-danger"></span>
</div>
<div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
<button type="button" onclick="addmessageto()" class="btn btn-success">Add More</button>
<button type="button" onclick="removemessageto()" class="btn btn-warning">Remove</button>
</div>
</div>
<span id="addmoreforwardto"></span>
<hr />
<div class="form-group">
<div class="col-xs-12 col-lg-10 col-sm-12 col-md-12">
<button type="button" class="btn btn-info" onclick="forwardmessage('forward')"> <i class="fa fa-send"></i> Forward to</button>
<button type="button" class="btn btn-info" onclick="forwardmessage('complete')"> <i class="fa fa-send"></i> Complete Action</button>
<a href="<?php echo base_url()?>index.php/Settings/view_ods_dashboard/"> <button type="button" class="btn btn-warning">
<i class="fa fa-dashboard" aria-hidden="true" ></i> Dashboad</span>
</button>
</a>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
I expect concatenated parameter that I passed from first view page to retrieve data from table and populate it into the final view page.
If you have data like l/54 or l/59 with varchar datatype column then below query will work.
public function tracks($letterno="")
{
//$query= $this->db->get_where('st_dak_details',array('dakLetterNo'=>$letterno));
$this->db->select('*');
$this->db->from('st_dak_details');
$this->db->like('dakLetterNo', $letterno); //'%l/54%'
$query= $this->db->get();
if ($query->num_rows() > 0) {
return $query->result_array();
} else {
return array();
}
}

Resources