Laravel app where clicking on add technician will add a new row. But it's showing an error! Requested unknown parameter. This is only occurring when I used the src in response blade app as i have to use date time function there. But without that tag it isn't working and using that src is leading to this error.
This is my table in blade.php.
<div class="col-md-12 col-xs-12 col-sm-12 panel-group">
<div class="col-md-10 col-sm-8 col-xs-8">
<h3>{{ trans('Technician')}}</h3>
</div>
<div class="col-md-2 col-sm-4 col-xs-4">
<button type="button" id="add_new_tech" url="{!! url('jobcard/view/getNewTech')!!}" class="btn btn-default">Add Technician</button>
</div>
</div>
<div class="col-md-12 col-xs-12 col-sm-12">
<div class="col-md-12 col-xs-12 col-sm-12" style="margin-top:20px;">
<div class="table-responsive">
<table class="table table-bordered addTechTable" id="tab_taxes_detail" align="center">
<thead>
<tr>
<th class="actionre">{{ trans('Type')}}</th>
<th class="actionre">{{ trans('No.of Technicians')}}</th>
<th class="actionre">{{ trans('Rate/Hour')}} (<?php echo getCurrencySymbols(); ?>)</th>
<th class="actionre">{{ trans('Chargeale Hour')}}</th>
<th class="actionre">{{ trans('From Date')}}</th>
<th class="actionre">{{ trans('To Date')}}</th>
<th class="actionre">{{ trans('No Work')}}</th>
<th class="actionre">{{ trans('Work')}}</th>
<th class="actionre">{{ trans('Total Cost')}} (<?php echo getCurrencySymbols(); ?>)</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr id="row_id_1">
<td>
<select name="type[tech_id][]" class=" type select_productname_1" url="{!! url('jobcard/view/getHourRate')!!}" row_did="1" data-id="1" required="required">
#foreach ($tech as $techs)
<option value="{{$techs->id}}">{{$techs->name}}</option>
#endforeach
</select>
</td>
<td>
<input type="text" name="product[qty][]" url="{!! url('jobcard/view/getqty')!!}" class="form-control quantity qty qty_1" id="qty_1" row_id="1" style="width:100%;" value="1" maxlength="8" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
<span class="qty_1">
</td>
<td>
<input required type="text" name="product[price][]" class="product prices price_1" id="price_1" row_id="1" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" readonly>
</td>
<td>
<input type="number" name="chr[][]" id="chr_1" row_id="1" >
</td>
<td>
<input type="datetime-local" name="fd[][]" id="fd_1" row_id="1" class="form-control fdate fdate_1 date">
</td>
<td>
<input type="datetime-local" name="td[][]" id="td_1" row_id="1" class="form-control tdate tdate_1 date" >
</td>
<td>
<input type="number" name="nwrk[][]" id="nwrk_1" row_id="1" >
</td>
<td>
<input type="text" class="wrk_1 wrk" url="{!! url('jobcard/view/wrkdiff')!!}" name="wrk[][]" id="wrk_1" row_id="1" >
</td>
<td>
<input type="text" name="product[total_price][]" class="product total_price total_price_1" id="total_price_1" readonly>
</td>
<td align="center" hidden>
<span class="product_delete" data-id="0"><i class="fa fa-trash fa-2x"></i> </span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
This is the jQuery file.
<script>
$("#add_new_tech").click(function()
{
var row_id = $("#tab_taxes_detail > tbody > tr").length;
var url = $(this).attr('url');
$.ajax({
type: 'GET',
url: url,
data : {row_id:row_id},
beforeSend : function () {
$("#add_new_tech").prop('disabled', true);
},
success: function (response)
{
$('.addTechTable').DataTable().row.add($(response.html)).draw();
$("#add_new_tech").prop('disabled', false);
return false;
},
error: function(e) {
alert(msg100 + " " + e.responseText);
console.log(e);
}
});
});
Controller function.
<?php
public function getNewTech(Request $request)
{
$id = $request->row_id;
$ids = $id+1;
$rowid = 'row_id_'.$ids;
$tech = DB::table('tbl_tech')->where('soft_delete', '=', 0)->get();
$html = view('jobcard.newtech')->with(compact('tech','rowid','id','ids'))->render();
return response()->json(['success' => true, 'html' => $html]);
}
?>
and finally from this blade file I'm getting the response.
<script src="{{ URL::asset('vendors/jquery/dist/jquery.min.js') }}"></script>
<tr id="row_id_<?php echo $ids;?>">
<td>
<select name="type[tech_id][]" class="form-control type select_productname_<?php echo $ids;?>" row_did="<?php echo $ids;?>" url="<?php echo url('jobcard/view/getHourRate');?>" data-id="<?php echo $ids;?>" style="width:100%;" required="required">
<?php foreach($tech as $techs) { ?>
<option value="<?php echo $techs->id;?>"><?php echo $techs->name;?></option> <?php } ?>
</select>
</td>
<td>
<input type="text" name="product[qty][]" row_id="<?php echo $ids; ?>" class="quantity form-control qty qty_<?php echo $ids;?>" url="<?php echo url('jobcard/view/getqty');?>" id="qty_<?php echo $ids;?>" value="1" style="width: 100%;" maxlength="8" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
<span class="qty_1">
</td>
<td>
<input required type="text" name="product[price][]" class="product form-control prices price_<?php echo $ids;?>" id="price_<?php echo $ids;?>" row_id="<?php echo $ids;?>" style="width:100%;" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" readonly>
</td>
<td>
<input type="number" name="chr[][]" id="chr_<?php echo $ids;?>" style="width:100%;" row_id="<?php echo $ids;?>" style="width:100%;" >
</td>
<td>
<input type="datetime-local" name="fd[][]" id="fd_<?php echo $ids;?>" row_id="<?php echo $ids;?>" class="form-control fdate fdate_<?php echo $ids;?> date">
</td>
<td>
<input type="datetime-local"class="form-control tdate tdate_<?php echo $ids;?> date " name="td[][]" id="td_<?php echo $ids;?>" style="width:100%;" row_id="<?php echo $ids;?>" style="width:100%;" >
</td>
<td>
<input type="number" name="nwrk[][]" class="nwrk_<?php echo $ids;?>" id="nwrk_<?php echo $ids;?>" style="width:100%;" row_id="<?php echo $ids;?>" style="width:100%;" >
</td>
<td>
<input type="number" name="wrk[][]" class="wrk wrk_<?php echo $ids;?>" url="<?php echo url('jobcard/view/wrkdiff');?>" id="wrk_<?php echo $ids;?>" style="width:100%;" row_id="<?php echo $ids;?>" style="width:100%;" >
</td>
<td>
<input type="text" name="product[total_price][]" class="product form-control total_price total_price_<?php echo $ids;?>" style="width:100%;" id="total_price_<?php echo $ids;?>" readonly>
</td>
<td align="center">
<span class="product_delete tax_<?php echo $ids;?>" data-id="<?php echo $ids;?>" id="tax_<?php echo $ids;?>"><i class="fa fa-trash fa-2x"></i> </span>
</td>
</tr>
Kindly help with this, Thank you.
I have a dynamic radio button that inserts a list of student attendance data
but only one student data is inserted. What am I doing wrong
When only the first student gets inserted. The rest of the students do not get inserted into the database
<div class="table">
<table class="table table-sm table-bordered mx-auto">
<tr>
<th>Student Name</th>
<th>Attendence Status</th>
</tr>
<tbody>
<?php
while ($row=mysqli_fetch_array($select)) {
$student_id=$row['student_id'];
$student_name=$row['student_lastname'].' '.$row['student_midname'].' '.$row['student_firstname'];
$link='student_images/'.$row['student_img'];
?>
<tr>
<td class="px-md-2" ><?php echo '<img src="'.$link.'" class="profile-user-img img-fluid img-circle" alt="Student Picture" />' ?>
<p class="profile-username lead"><?php echo $student_name; ?></p>
<p class="text-muted "><?php echo "Date:".' '.date("d/m/Y"); ?></p>
</td>
<td class="mx-auto" style="width: 40%;">
<div class="radio icheck-square">
<input type="radio" value="1" id="state" name="<?php echo $student_id; ?>" />
<label for="present">Present</label>
</div>
<div class="radio icheck-square">
<input type="radio" value="0" id="state" name="<?php echo $student_id; ?>" />
<label for="absent">Absent</label>
</div></td>
</tr>
<input type="hidden" name="student_id" id="student_id" value="<?php echo $student_id ?>">
<input type="hidden" name="date" id="date" value="<?php echo date("Y/m/d"); ?>">
<?php
}
?>
</tbody>
</table>
<div class="row">
<div class="col">
<button class="btn btn-primary" onclick="AddOnly();">Add Attendance Only</button>
or
<button class="btn btn-info" onclick="AddSend();">Add Attendance & Alert Parents</button>
</div>
</div>
</div>
</div>
The PHP code is that processes the data is below
$state=$_POST['state'],
$student_id=$_POST['student_id'];
$date=$_POST['date'];
$insert=mysqli_query($conn,"INSERT INTO `aza_attendance`(`attendance_id`, `student_id`, `atten_date`, `state`) VALUES (NULL, '$student_id', '$date', '$state')") or die(mysqli_error($conn));
if ($insert) {
if ($state==1) {
echo $student_id. 'was at school on'.' '.$date;
}else if($state==0){
echo $student_id. 'was at <strong>NOT</strong> school on'.' '.$date;
}
}
i think is not good to use a variable in name like you use here name="" i think this is better just put them in one div
<div class="radio icheck-square">
<input type="radio" value="1" id="state" name="state" />
<label for="present">Present</label>
<input type="radio" value="0" id="state" name="state" />
<label for="absent">Absent</label>
</div>
I want to do crud on my page and I have to get content from another table and display it in a select tag. my plan was to make an update page wherein it will get the data from another table to display (in this case the category_name, cat_id was the foreign key at the menu table).
I already tried to join because that's what other forums have said but I think I was wrong.
help would really be appreciated.
this is my model:
function inputMenuToUpdate($menu_id){
$this->db->select('cat_id, category.category_id, category.category_name AS category_name');
$this->db->from('menu');
$this->db->join('category', 'menu.cat_id = category.category_id');
$this->db->where('menu_id',$menu_id);
return $query->row();
}
this is my controller:
public function inputToUpdate($menu_id){
$data['row'] = $this->adminMenuModel->inputMenuToUpdate($menu_id);
$this->load->view('adminEdit', $data);
}
this is my view:
<tbody>
<!-- $result is from the $data in CrudController-->
<?php foreach($result as $row){?>
<tr>
<td><?php echo $row->menu_name; ?></td>
<td><?php echo $row->category_name; ?></td>
<td><?php echo $row->price; ?></td>
<td><?php echo $row->description; ?> </td>
<td>
<i class="fa fa-pencil"></i>
</td>
</tr>
<?php } ?>
</tbody>
and this is my update page:
<div class="container" style="width: 40rem;">
<form method="POST" action="<?php echo site_url('adminMenuController/update'); ?> / <?php echo $row->category_id; ?>">
<button type="button" class="btn btn-link"> Go Back </button>
<h1> UPDATE MENU </h1>
<div class="border-bottom"></div>
<br>
<br>
<label for="upMName">New Drink Name</label>
<input type="text" name="mn" class="form-control" id="upMName" value="<?php echo $row->menu_name ?>"></input>
<!-- <label for="cat"> Category </label>
<select id="cat" class="form-control">
<option> <?php echo $row->category_name; ?> </option>
</select> -->
<label for="upPrice">New Price</label>
<input type="number" name="price" class="form-control" id="upPrice" value="<?php echo $row->price ?>"> </input>
<label for="updesc">New Description </label>
<input type="text" name="desc" class="form-control" id="updesc" value="<?php echo $row->description ?>"> </input>
<br>
<button type="submit" class="btn btn-info"> Update </button>
<button type="reset" class="btn btn-danger"> Cancel </button>
</form>
</div>
I'm building an Inventory management system but stuck with a search query.
I've tables named:
products
product_purchases
product_sales
Now, want to get product details from "products" table by searching "product_id" and fetch/show the product details in the appropriate HTML fields then add/insert the product details data into "product_purchases" table.
Similarly, want to get product details from "product_purchases" table by searching "product_purchase_id" and fetch/show the product details in the appropriate HTML fields then add/insert the product details data into "product_sales" table.
The problem is - I used $.post method to query my product details but it won't work.
Here I just added the screenshot of my purchase
code of my purchase page:
<form action="" method="post" class="form-search">
<div class="input-group">
<input type="text" class="form-control" name="product_id" id="product_id" placeholder="Search a product by ID">
<span class="input-group-btn">
<button name="searchProduct" value="Search" class="btn btn-primary">Search</button>
</span>
</div>
</form>
<form action="" method="post">
<fieldset id="general-settings">
<legend><h3 class="fields-heading">Item details</h3></legend>
<?php
if (isset($_POST['addPurchase'])){
$product_id = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['product_id']));
$product_name = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['product_name']));
$supplier_name = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['supplier_name']));
$brand_name = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['brand_name']));
$group_name = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['group_name']));
$unit_price = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['unit_price']));
$quantity = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['quantity']));
$bonus_quantity = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['bonus_quantity']));
$total_price = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['total_price']));
$total_bonus_price = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['total_bonus_price']));
$unit_sale_price = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['unit_sale_price']));
if ( empty($product_id) && empty($product_name) && empty($supplier_name) && empty($brand_name) && empty($group_name) && empty($unit_price) && empty($quantity) && empty($bonus_quantity) && empty($total_price) && empty($total_bonus_price) && empty($unit_sale_price) ){
echo "<p class='text-error'>Star (*) marks are required fields and cannot be empty!</p>";
}else{
$insert = $db->insert("purchases", "product_id, product_name, supplier_id, brand_id, group_id, unit_price, quantity, bonus_quantity, total_price, total_bonus_price, unit_sale_price", "'$product_id', '$product_name', '$supplier_name', '$brand_name', '$group_name', '$unit_price', '$quantity', '$bonus_quantity', '$total_price', $total_bonus_price, '$unit_sale_price'");
if($insert){ ?>
<script>
alert("Product added successfully!");
window.location.assign("inventory-purchase.php");
</script>
<?php
}else{
echo "<p class='text-error'>Product not added!</p>";
}
}
}
?>
<table class="table table-responsive table-settings">
<tbody>
<tr>
<div class="form-group">
<td><label for="product_id">Product ID <span class="required">*</span></label></td>
<td>:</td>
<td><input type="text" class="form-control" name="product_id" id="product_id"></td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="product_name">Name <span class="required">*</span></label></td>
<td>:</td>
<td><input type="text" class="form-control" name="product_name" id="product_name"></td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="supplier_name">Supplier <span class="required">*</span></label></td>
<td>:</td>
<td>
<select class="form-control" name="supplier_name" id="supplier_name">
<option>Select a supplier</option>
<?php $getsuppliers = $db->select("supplier_id, supplier_name", "suppliers");
if ($getsuppliers) {
while ( $getsplr = $getsuppliers->fetch_assoc() ){
?>
<option value="<?php echo $getsplr['supplier_id']; ?>"><?php echo $getsplr['supplier_name']; ?></option>
<?php } }?>
</select>
</td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="brand_name">Brand <span class="required">*</span></label></td>
<td>:</td>
<td>
<select class="form-control" name="brand_name" id="brand_name">
<option>Select a brand</option> <?php $getbrands = $db->select("brand_id, brand_name", "brands");
if ($getbrands) {
while ( $getbrnd = $getbrands->fetch_assoc() ){
?>
<option value="<?php echo $getbrnd['brand_id']; ?>"><?php echo $getbrnd['brand_name']; ?></option>
<?php } }?>
</select>
</td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="group_name">Group <span class="required">*</span></label></td>
<td>:</td>
<td>
<select class="form-control" name="group_name" id="group_name">
<option>Select a group</option>
<?php $getgroups = $db->select("group_id, group_name", "groups");
if ($getgroups) {
while ( $getgrp = $getgroups->fetch_assoc() ){
?>
<option value="<?php echo $getgrp['group_id']; ?>"><?php echo $getgrp['group_name']; ?></option>
<?php } }?>
</select>
</td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="unit_price">Unit price <span class="required">*</span></label></td>
<td>:</td>
<td>
<div class="input-group">
<span class="input-group-addon">$</span>
<input type="text" class="form-control" name="unit_price" id="unit_price">
</div>
</td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="quantity">Quantity <span class="required">*</span></label></td>
<td>:</td>
<td><input type="text" class="form-control" name="quantity" id="quantity"></td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="bonus_quantity">Bonus Quantity</label></td>
<td>:</td>
<td><input type="text" class="form-control" name="bonus_quantity" id="bonus_quantity"></td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="total_price">Total price</label></td>
<td>:</td>
<td>
<div class="input-group">
<span class="input-group-addon">$</span>
<input readonly type="text" class="form-control" name="total_price" id="total_price">
</div>
</td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="total_bonus_price">Total bonus price</label></td>
<td>:</td>
<td>
<div class="input-group">
<span class="input-group-addon">$</span>
<input readonly type="text" class="form-control" name="total_bonus_price" id="total_bonus_price">
</div>
</td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="unit_sale_price">Unit sale price <span class="required">*</span></label></td>
<td>:</td>
<td>
<div class="input-group">
<span class="input-group-addon">$</span>
<input type="text" class="form-control" name="unit_sale_price" id="unit_sale_price">
</div>
</td>
</div>
</tr>
<tr>
<td colspan="3"><input type="submit" name="addPurchase" value="Add purchase" class="btn btn-primary btn-lg btn-register"></td>
</tr>
</tbody>
</table>
</fieldset>
</form>
and sale product page.
ocde of my sales page
<form action="" method="post" class="form-search">
<div class="input-group">
<input type="text" class="form-control" name="product_id" id="product_id" placeholder="Search a product by ID">
<span class="input-group-btn">
<button name="searchProduct" value="Search" class="btn btn-primary">Search</button>
</span>
</div>
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$product_id = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['product_id']));
$product_name = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['product_name']));
$unit_sale_price = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['unit_sale_price']));
$quantity = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['quantity']));
$total_sale_price = $frmt->sanitize(mysqli_real_escape_string($db->link, $_POST['total_sale_price']));
if ( empty($product_id) && empty($quantity) ){
echo "<p class='text-error'>Star (*) marks are required fields and cannot be empty!</p>";
}else{
$insert = $db->insert("sales", "product_id, product_name, unit_sale_price, quantity, total_sale_price", "'$product_id', '$product_name', '$unit_price', '$quantity', '$total_sale_price'");
if($insert){ ?>
<script>
alert("Product sent to invoice successfully!");
window.location.assign("inventory-sale.php");
</script>
<?php
}else{
echo "<p class='text-error'>Product not sent to invoice!</p>";
}
}
}
?>
<form action="" method="post">
<fieldset id="general-settings">
<legend><h3 class="fields-heading">Item details</h3></legend>
<table class="table table-responsive table-settings">
<tbody>
<tr>
<div class="form-group">
<td><label for="product_id">Product ID <span class="required">*</span></label></td>
<td>:</td>
<td><input type="text" class="form-control" name="product_id" id="product_id" placeholder="Search an item by ID"></td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="product_name">Product name</label></td>
<td>:</td>
<td><input type="text" readonly class="form-control" name="product_name" id="product_name" value=""></td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="unit_sale_price">Unit sale price</label></td>
<td>:</td>
<td>
<div class="input-group">
<span class="input-group-addon">$</span>
<input type="number" readonly class="form-control" name="unit_sale_price" id="unit_sale_price" value="">
</div>
</td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="quantity">Quantity <span class="required">*</span></label></td>
<td>:</td>
<td><input type="number" class="form-control" name="quantity" id="quantity" placeholder="Enter quantity"></td>
</div>
</tr>
<tr>
<div class="form-group">
<td><label for="total_sale_price">Total price</label></td>
<td>:</td>
<td>
<div class="input-group">
<span class="input-group-addon">$</span>
<input readonly type="text" disabled class="form-control" name="total_sale_price" id="total_sale_price">
</div>
</td>
</div>
</tr>
<tr>
<td colspan="3"><input type="submit" name="sale_invoice" value="Sent to invoice" class="btn btn-primary btn-lg btn-register"></td>
</tr>
</tbody>
</table>
</fieldset>
</form>
FYI: I'm working with PHP OOP, but not any framework.
Anybody around to help me out of this problem?
Try to use ajax request with post method to get data and populate in your forms and archive your next step
how to use ajax with OOP
It help you get data without refreshing and populate in your form fields. Same for PHP just call your controller with ajax request then same OOP way get data from database from Model and return data in JSON format and use in your fields.
Need more information feel free to ask :)
I am trying to update the record in database using codelgniter but its not working. Please check the code and assist me where am i wrong? Please check the error also.Please help me.
Controller code
public function update()
{
$id=$this->uri->segment(3);
$this->load->model('model_edit');
$a=$this->model_edit->update($id);
$data['userId']= $a->userId;
$data['date']= $a->date;
$data['firtsname']= $a->firtsname;
$data['middlename']= $a->middlename;
$data['lastname']= $a->lastname;
$data['mobileno']= $a->mobileno;
$data['landline']= $a->landline;
$data['address']= $a->address;
$data['city']= $a->city;
$data['locality']= $a->locality;
$data['email']= $a->email;
$this->load->view("index",$data);
}
Model code
public function update($userId)
{
$query = $this->db->get_where('add_user', array('id' => $userId));
return $query;
}
View code
<body>
<div class="container">
<div class="tab-center">
<div id="tabs">
<ul>
<li>Add User</li>
<li>User List</li>
</ul>
<div id="tabs-1">
<div class="title">
<p><strong>ADD USER</strong></p>
</div>
<?php echo form_open("Welcome/add_user"); ?>
<input type="text" name="userId" placeholder="USER ID" style="width:500px">
<input type="date" name="date" style="width:500px">
<input type="text" name="firtsname" placeholder="FIRST NAME" style="width:330px">
<input type="text" name="middlename" placeholder="MIDDLE NAME" style="width:330px">
<input type="text" name="lastname" placeholder="LAST NAME" style="width:330px">
<input type="text" name="mobileno" placeholder="ENTER MOBILE NO." style="width:500px">
<input type="text" name="landline" placeholder="LANDLINE No." style="width:500px">
<textarea name="address" placeholder="ENTER ADDRESS"></textarea>
<input type="text" name="city" placeholder="CITY" style="width:500px">
<input type="text" name="locality" placeholder="LOCALITY" style="width:500px">
<input type="text" name="email" placeholder="ENTER EMAIL" style="width:1010px"></br>
<input type="submit" class="submit" name="SUBMIT">
<?php echo form_close(); ?>
</div>
<div id="tabs-2">
<div class="table-responsive">
<table class="table table-bordered" >
<thead>
<tr>
<td><b></b></td>
<td><b></b></td>
<td><b>userId</b></td>
<td><b>firtsname</b></td>
<td><b>lastname</b></td>
<td><b>mobileno</b></td>
<td><b>address</b></td>
<td><b>city</b></td>
<td><b>email</b></td>
</tr>
</thead>
<?php
foreach ($user->result() as $row)
{
?>
<tbody><tr >
<td><img src="http://localhost/CRM/img/delete.png" name="delete_image" ></td>
<td><img src="http://localhost/CRM/img/edit.png" name="edit_image" ></td>
<td><?php echo $row->userId;?></td>
<td><?php echo $row->firtsname;?></td>
<td><?php echo $row->lastname;?></td>
<td><?php echo $row->mobileno;?></td>
<td><?php echo $row->address;?></td>
<td><?php echo $row->city;?></td>
<td><?php echo $row->email;?></td>
</tr> </tbody>
<?php }
?>
</table>
</div>
</div>
try this
function update($id, $data = array()) {
$this->db->get_where('add_user', array('id' => $userId))->result_array();
}