storing array value in laravel - php

I want to store form array value. but it giving some errors please help
receiving error
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'product_name' cannot be null (SQL: insert into bill_products (product_name, bill_no, suppliers_master_id, suppliers_unic_id, party_id, supplier_name, GSTIN, bill_date, bill_entry_date, qty, HSN_SAC, sale_rate, MRP_rate, purchase_rate, part_no, updated_at, created_at) values (?, 111w, master_5499384803, unic_5764728886, PARTY-NO922826, dvfd, fg99, 06-08-2020, 15-08-2020, 1, 1, 11, 1, 1, 1, 2020-08-15 16:24:28, 2020-08-15 16:24:28))
This is my controller
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'product_name' cannot be null (SQL: insert into `Item_list`
This is my controller
public function purchaseentryformsave(Request $request)
{
$purchasen=new Purchase;
$purchasen->supplier_name = $request->supplier_name;
$purchasen->bill_no = $request->bill_no;
$purchasen->suppliers_master_id = $request->suppliers_master_id;
$purchasen->party_id = $request->party_id;
$purchasen->GSTIN = $request->GSTIN;
$purchasen->bill_date = $request->bill_date;
$purchasen->bill_entry_date = $request->bill_entry_date;
$purchasen->total_bill_amount = $request->total_bill_amount;
$purchasen->phone = $request->phone;
$purchasen->pincode = $request->pincode;
$purchasen->state = $request->state;
$purchasen->address = $request->address;
$purchasen->suppliers_unic_id = $request->suppliers_unic_id;
if ($purchasen->save()){
$product_name = $purchasen->product_name;
$bill_no = $purchasen->bill_no;
$suppliers_master_id = $purchasen->suppliers_master_id;
$suppliers_unic_id = $purchasen->suppliers_unic_id;
$party_id = $purchasen->party_id;
$supplier_name = $purchasen->supplier_name;
$GSTIN = $purchasen->GSTIN;
$bill_date = $purchasen->bill_date;
$bill_entry_date = $purchasen->bill_entry_date;
foreach($request->qty as $k => $p){
Billproduct::create([
'product_name' => $product_name,
'bill_no' => $bill_no,
'suppliers_master_id' => $suppliers_master_id,
'suppliers_unic_id' => $suppliers_unic_id,
'party_id' => $party_id,
'supplier_name' => $supplier_name,
'GSTIN' => $GSTIN,
'bill_date' => $bill_date,
'bill_entry_date' => $bill_entry_date,
'qty' => $request['qty'][$k],
'HSN_SAC' => $request['HSN_SAC'][$k],
'sale_rate' => $request['sale_rate'][$k],
'MRP_rate' => $request['MRP_rate'][$k],
'purchase_rate' => $request['purchase_rate'][$k],
'part_no' => $request['part_no'][$k],
]);
}
foreach($request->qty as $g => $p){
Item_list::create([
'supplier_name' => $supplier_name,
'product_name' => $product_name,
'qty' => $request['qty'][$g],
'purchase_rate' => $request['purchase_rate'][$g],
'MRP_rate' => $request['MRP_rate'][$g],
'sale_rate' => $request['sale_rate'][$g],
'part_no' => $request['part_no'][$g],
]);
}
}
return back()->with('success',' NEW PURCHASE ADDED SUCCESSFULLY .');
}
this is my view
<div class="container">
<div class="row justify-content-center">
<div class="col-md-12">
<div class="card">
<div class="card-header">PURCHASE FORM</div>
<div class="card-body">
#if (Session::has('success'))
<div class="alert alert-success">{!! Session::get('success') !!}</div>
#endif
#if (Session::has('failure'))
<div class="alert alert-danger">{!! Session::get('failure') !!}</div>
#endif
<form method="POST" action="{{route('purchaseentryformsave')}}" enctype="multipart/form-data">
#csrf
<input type="text"style="background-color:yellow ;" class="form-control " name="suppliers_master_id" placeholder="SUPPLIER NAME" value="{{ $Supplierdata->suppliers_master_id }}" hidden>
<input type="text"style="background-color:yellow ;" class="form-control " name="suppliers_unic_id" placeholder="SUPPLIER NAME" value="{{ $Supplierdata->suppliers_unic_id }}" hidden>
<input type="text"style="background-color:yellow ;" class="form-control " name="GSTIN" placeholder="SUPPLIER NAME" value="{{ $Supplierdata->GSTIN }}" hidden>
<input type="text"style="background-color:yellow ;" class="form-control " name="phone" placeholder="SUPPLIER NAME" value="{{ $Supplierdata->phone }}" hidden>
<input type="text"style="background-color:yellow ;" class="form-control " name="pincode" placeholder="SUPPLIER NAME" value="{{ $Supplierdata->pincode }}" hidden>
<input type="text"style="background-color:yellow ;" class="form-control " name="state" placeholder="SUPPLIER NAME" value="{{ $Supplierdata->state }}" hidden>
<input type="text"style="background-color:yellow ;" class="form-control " name="address" placeholder="SUPPLIER NAME" value="{{ $Supplierdata->address }}" hidden>
<div class="form-row">
<div class="col-md-4 mb-3">
<label for="validationServer01">SUPPLIER NAME</label>
<input type="text"style="background-color:yellow ;" class="form-control " name="supplier_name" id="validationServer01" placeholder="SUPPLIER NAME" value="{{ $Supplierdata->supplier_name }}" required >
</div>
<div class="col-md-2 mb-3">
<label for="validationServer01">PARTY-NO</label>
<input type="text" style="background-color:yellow ;" class="form-control" name="party_id" id="validationServer01" placeholder="PARTY-NO" value="{{ $Supplierdata->party_id}}" required >
</div>
<div class="col-md-2 mb-3">
<label for="validationServer01">BILL DATE</label>
<input type=" " class="form-control " name="bill_date" id="date" placeholder="BILL DATE" value="" required >
</div>
<div class="col-md-2 mb-3">
<label for="validationServer01">BILL ENTRY DATE</label>
<input type="" class="form-control " name="bill_entry_date" placeholder="BILL DATE" value="<?php echo date('d-m-yy'); ?>" required>
</div>
<div class="col-md-2 mb-3">
<label for="validationServer01">BILL NO</label>
<input type="text" class="form-control " name="bill_no" id="validationServer01" placeholder="BILL NO" value="" required >
</div>
</div>
<div class="form-row">
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
<style>
table thead { display:block; }
table tbody { height:250px; overflow-y:scroll; display:block; }
</style>
</div>
<table id="tableAppointment" style="background-color:powderblue;">
<tr>
<th style="text-align:center;" colspan="1">Description of Goods</th>
<th style="text-align:center;" colspan="1">HSN/SAC</th>
<th style="text-align:center;" colspan="1">MRP</th>
<th style="text-align:center;" colspan="1">Part No</th>
<th style="text-align:center;" colspan="1">Qty</th>
<th style="text-align:center;" colspan="1">GST</th>
<th style="text-align:center;" colspan="1">Rate</th>
<th style="text-align:center;" colspan="1">Sale Rate</th>
<th style="text-align:center;" colspan="1">Amout</th>
</tr>
<tr>
<td ><input style="text-align:center;" type="text" class="text-danger form-control " name="product_name[]" id="validationServer01" placeholder="Item" value="" required autocomplete="off" ></td>
<td ><input style="text-align:center;" type="text" class="text-danger input-lg form-control " name="HSN_SAC[]" id="validationServer01" placeholder="HSN/SAC" value="" required autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="form-control " name="MRP_rate[]" id="validationServer01" placeholder="MRP" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control " name="part_no[]" id="validationServer01" placeholder="PART-NO" value="" required autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control quantity" name="qty[]" id="validationServer01" placeholder="QTY" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control gst " name="gst_amount[]" id="validationServer01" placeholder="GST" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control price" name="purchase_rate[]" id="validationServer01" placeholder="RATE" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control " name="sale_rate[]" id="validationServer01" placeholder="Sale Rate" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control totalamount" name="" id="validationServer01" placeholder="AMOUNT" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" disabled></td>
</tr>
<tr>
<td ><input style="text-align:center;" type="text" class="text-danger form-control " name="product_name[]" id="validationServer01" placeholder="Item" value="" required autocomplete="off" ></td>
<td ><input style="text-align:center;" type="text" class="text-danger input-lg form-control " name="HSN_SAC[]" id="validationServer01" placeholder="HSN/SAC" value="" required autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="form-control " name="MRP_rate[]" id="validationServer01" placeholder="MRP" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control " name="part_no[]" id="validationServer01" placeholder="PART-NO" value="" required autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control quantity" name="qty[]" id="validationServer01" placeholder="QTY" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control gst " name="gst_amount[]" id="validationServer01" placeholder="GST" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control price" name="purchase_rate[]" id="validationServer01" placeholder="RATE" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control " name="sale_rate[]" id="validationServer01" placeholder="Sale Rate" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" autocomplete="off"></td>
<td > <input style="text-align:center;" type="text" class="text-danger input-lg form-control totalamount" name="" id="validationServer01" placeholder="AMOUNT" value="" required pattern="[1-2-3-4-3-5-6-7-8-9-10-12]+"numbers="onlynumbers" disabled></td>
</tr>
</table>
<br>
<div class="row justify-content-between">
<div class="text-danger col-md-2 offset-md-10">
<b>VALVE OF GOODS</b>
</div>
</div>
<div class="row justify-content-between">
<div class="col-md-2 offset-md-10"> <input type="text" class=" text-danger form-control total" name="total_bill_amount" id="validationServer01" placeholder=" VALVE OF GOODS" required >
</div>
</div>
<hr>
<button class="btn btn-primary float-right" type="submit">SAVE</button>
</form>
<a style='margin-right:40px' class="btn btn-secondary float-right" href="{{ route('allpurchasesupplierlist') }}" role="button">BACK</a>
</div>
</div>
</div>
</div>
</div>
this is my route
Route::get('purchaseentryform{id}', 'PurchaseController#purchaseentryform')->name('purchaseentryform');
Route::post('purchaseentryformsave', 'PurchaseController#purchaseentryformsave')->name('purchaseentryformsave');
my model
Billproduct
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Billproduct extends Model
{
protected $table = 'bill_products';
protected $fillable = ['supplier_name','suppliers_master_id','suppliers_unic_id','GSTIN','party_id','bill_no','bill_entry_date','bill_date','product_name','qty','purchase_rate','MRP_rate','supplier_name','sale_rate','HSN_SAC','part_no'];
}
my model
**Item_list **
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Item_list extends Model
{
protected $table = 'item_lists';
protected $fillable = ['product_name','qty','purchase_rate','MRP_rate','sale_rate','supplier_name','part_no'];
}
my model
**Purchase **
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Purchase extends Model
{
protected $table = 'purchases';
protected $fillable = ['suppliers_master_id','suppliers_unic_id','party_id','supplier_name','GSTIN','bill_no','bill_date','bill_entry_date','total_bill_amount','phone','pincode','state','address','delete_states','part_no'];
}

You should add $purchasen->product_name = $request->product_name; before if ($purchasen->save())
$purchasen=new Purchase;
$purchasen->product_name = $request->product_name;
Then
if ($purchasen->save()){
$product_name = $purchasen->product_name;
}

Related

Call to a member function hashName() on array

and I have a problem with how to enter images into the data base, in the case of the presence of input fields that increase or decrease in the case of addition or deletion
This is the code for adding data to the database
$products = $request->day_book_id;
for ($i=0; $i<count($products); $i++) {
$items = new Daybooks_units();
$items->debit= $request->debit[$i];
$items->creditor= $request->creditor[$i];
$items->data= $request->data[$i];
$items->reference= $request->reference[$i];
$items->files= $request->reference[$i];
$items->files = uploadImage('filesDayBooks',$request->images)[$i];
$items->dayBook_code= $request->dayBook_code[$i];
$items->fullAccounting_id= $request->fullAccounting_id[$i];
$items->day_book_id= $request->day_book_id[$i];
$items->branch_id= $request->branch_id[$i];
$items->save();
This is the code for the blade
<td style="padding:3px" >
<input type="text" class="search" name="search" required>
<select class="form-control search_list getData" id="search_list" name="fullAccounting_id[]"></select>
#error('fullAccounting_id')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
#enderror
</td>
<td style="display:none" >
<input type="text" value=" " class=" form-control putParentId" name="ParentOfAccounting_manual_id[]">
</td>
<td style="display:none">
<input type="text" value=" " class=" form-control putCode" name="code_accountingManuals[]">
</td>
<td style="display:none">
<input type="text" value=" " class=" form-control debtor_creditor" name="debtor_creditor[]">
</td>
<td style="padding:3px">
<input type="text" value="0" class=" form-control totaldebit" onchange="getTotalRowPrice(this , '{{-500}}' )" name="debit[]">
#error('debit')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
#enderror
</td>
<td style="width:100px;">
<input type="text" onchange="getTotalRowPrice(this , '{{-500}}' )" value="0" class=" form-control totalcreditor" name="creditor[]">
#error('creditor')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
#enderror
</td>
<td style="padding:3px">
<input type="text" value="" class=" form-control" name="data[]">
</td>
<td style="width:100px;">
<select name="branch_id[]" required class="form-control">
<option></option>
#foreach($costCenters as $costCent)
<option value="{{$costCent->id}}">{{$costCent->name}}</option>
#endforeach
</select>
#error('branch_id')
<div class="alert alert-danger" role="alert">
{{ $message }}
</div>
#enderror
</td>
<td style="padding:3px">
<input type="text" class="form-control " name="reference[]" value="">
</td>
<td style="display:none;">
<input type="text" class="form-control " name="id_unit[]" value="{{ $id_unit }}">
</td>
<td style="display:none;">
<input type="text" class="form-control " name="daybooks_units[]" value="daybooks_units">
</td>
<td style="padding:3px">
<input type="file" name="images[]" multiple class="form-control" id="customFile">
</td>
<td style="padding:3px">
<input type="button" class="btn btn-success" name="add" id="add" value="add" style="color: white">
</td>
The function works smoothly if no images are inserted, but when images are uploaded, this error appears
I have no idea what your custom (not shared) uploadeImage function does, but the error SHOULD be here:
// You coded
$items->files = uploadImage('filesDayBooks',$request->images)[$i];
// It should be
$items->files = uploadImage('filesDayBooks',$request->images[$i]);
If that is not the error, please share uploadeImage code

I have a dynamically added multiple row table that created using php and jQuery

I have a dynamically added multiple row table that created using php and jQuery.html & jquery working fine. but,when I insert the data into the database, it works only for single row. when i want to add multiple rows it shows error.
when i want to insert multiple rows it works only for the first row and shows error ....
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'button_line' cannot be null in E:\xampp\htdocs\atiq\New-Project\ButtonTexMine\name.php:47 Stack trace: #0 E:\xampp\htdocs\atiq\New-Project\ButtonTexMine\name.php(47): PDOStatement->execute(Array) #1 {main} thrown in E:\xampp\htdocs\atiq\New-Project\ButtonTexMine\name.php on line 47
anybody please help ? My insert queries are as below:
<form action="name.php" method="post" name="add_name" id="add_name">
<div class="row" id="div1" style="background-color:#fafbf6;color:#000;">
<div class="col-xs-2">
<div class="form-group">
<label>Date</label>
<div>
<div class="input-group">
<input name="date" type="text" class="form-control" placeholder="mm/dd/yyyy" id="datepicker-autoclose">
<span class="input-group-addon bg-custom b-0"><i class="mdi mdi-calendar text-white"></i></span>
</div><!-- input-group -->
</div>
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Party Name</label>
<input type="text" class="form-control" maxlength="100" name="party_name" id="placement" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Party Address</label>
<input type="text" class="form-control" maxlength="500" name="party_address" id="placement" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Party Ref</label>
<input type="text" class="form-control" maxlength="100" name="party_ref" id="placement" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Work Order No</label>
<input type="text" class="form-control" maxlength="30" name="won" id="placement" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Work Order Off</label>
<input type="text" class="form-control" maxlength="100" name="woof" id="placement" />
</div>
</div>
</div>
<div class="row" id="div1" style="background-color:#fafbf6;color:#000;">
<div class="table-responsive">
<table class="table table-bordered" id="dynamic_field">
<thead>
<th>Button Line</th>
<th>Button Hole</th>
<th>Button Type</th>
<th>Logo Button</th>
<th>Qty</th>
<th>Rate</th>
<th>Amount</th>
<th>Revised Rate</th>
<th>Revised Amount</th>
<th></th>
</thead>
<tbody>
<tr>
<td><select name="button_line[]" class="form-control name_list">
<option value=''>Select Option</option>
<option value="14L">14L</option>
<option value="16L">16L</option>
<option value="18L">18L</option>
<option value="20L">20L</option>
<option value="22L">22L</option>
<option value="24L">24L</option>
<option value="26L">26L</option>
<option value="28L">28L</option>
<option value="30L">30L</option>
<option value="32L">32L</option>
<option value="36L">36L</option>
<option value="40L">40L</option>
<option value="44L">44L</option>
<option value="48L">48L</option>
<option value="54L">54L</option>
<option value="60L">60L</option>
</select> </td>
<td><select name="button_hole[]" class="form-control name_list">
<option value=''>Select Option</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='others'>Otheres</option>
</select> </td>
<td><select name="button_type[]" class="form-control name_list">
<option value=''>Select Option</option>
<option value='Pearl'>Pearl</option>
<option value='Chalk'>Chalk</option>
<option value='Horn'>Horn</option>
<option value='T.P.T'>T.P.T</option>
</select> </td>
<td><select name="logo_button[]" class="form-control name_list">
<option value=''>Select Option</option>
<option value='yes'>Yes</option>
<option value='no'>No</option>
</select> </td>
<td><input type="text" name="qty[]" id="qty0" onchange="sum(0)" placeholder="Enter your Qty" class="form-control name_list" /></td>
<td><input type="text" name="rate[]" id="rate0" onchange="sum(0)" placeholder="Enter your Rate" class="form-control name_list" /></td>
<td><input type="text" name="total[]" id="sum0" class="form-control name_list" /></td>
<td><input type="text" name="r_rate[]" id="Rrate0" onchange="sum(0)" placeholder="Enter your Rate" class="form-control name_list" /></td>
<td><input type="text" name="r_amount[]" id="Rsum0" class="form-control name_list" /></td>
<td><button type="button" name="add" id="add" class="btn btn-success">Add More</button></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-xs-2">
<div class="form-group">
<label>Proforma Invoice Number</label>
<input type="text" class="form-control" maxlength="30" name="pro_in_no" id="placement" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Proforma Invoice Date</label>
<input type="text" class="form-control" maxlength="30" name="pro_in_date" id="placement" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Cash Bill Number</label>
<input type="text" class="form-control" maxlength="100" name="cash_bill_no" id="" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>LC SL No</label>
<input type="text" class="form-control" maxlength="30" name="lc_sl_no" id="" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>LC No</label>
<input type="text" class="form-control" maxlength="30" name="lc_no" id="" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>LC Date</label>
<input type="text" class="form-control" maxlength="30" name="lc_date" id="placement" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Total Amount</label>
<input type="text" class="form-control" maxlength="30" name="total_amount" id="allsum" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Pay Amount</label>
<input type="text" class="form-control" maxlength="30" name="pay_amount" id="pay" />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Due</label>
<input type="text" class="form-control" maxlength="30" name="due" id="dueA" readonly />
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<label>Mode of Payment</label>
<select name="mode" class="form-control select2">
<option>Select</option>
<option value="Cash">Cash</option>
<option value="LC">LC</option>
</select>
</div>
</div>
<div class="col-xs-2">
<div class="form-group">
<div class="modal-footer">
<input type="submit" name="submit" id="submit" class="btn btn-info" value="Submit" />
</div>
</div>
</div>
</div>
</form>
<script>
var i=0;
$(document).ready(function(){
$('#add').click(function(){
i++;
$('#dynamic_field').append('<tr id="row'+i+'"><td><select name="button_line['+i+']" class="form-control name_list"><option value="">Select Option</option><option value="14L">14L</option><option value="16L">16L</option><option value="18L">18L</option><option value="20L">20L</option><option value="22L">22L</option><option value="24L">24L</option><option value="26L">26L</option><option value="28L">28L</option><option value="30L">30L</option><option value="32L">32L</option><option value="36L">36L</option><option value="40L">40L</option><option value="44L">44L</option><option value="48L">48L</option><option value="54L">54L</option><option value="60L">60L</option></select></td><td><select name="button_hole['+i+']" class="form-control name_list"><option value="#">Select Option</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="others">Otheres</option></select> </td><td><select name="button_type['+i+']" class="form-control name_list"><option value="#">Select Option</option><option value="Pearl">Pearl</option><option value="Chalk">Chalk</option><option value="Horn">Horn</option><option value="T.P.T">T.P.T</option></select></td><td><select name="logo_button[]" class="form-control name_list"><option value="#">Select Option</option><option value="yes">Yes</option><option value="no">No</option></select></td><td><input type="text" name="qty['+i+']" id="qty'+i+'" onchange="sum(0)" placeholder="Enter your Qty" class="form-control name_list" /></td><td><input type="text" name="rate['+i+']" id="rate'+i+'" onchange="sum(0)" placeholder="Enter your Rate" class="form-control name_list" /></td><td><input type="text" name="total[]" id="sum'+i+'" class="form-control name_list" /></td><td><input type="text" name="r_rate[]" id="rate0" onchange="sum(0)" placeholder="Enter your Rate" class="form-control name_list" /></td><td><input type="text" name="r_amount[]" id="sum0" class="form-control name_list"/></td><td><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove">X</button></td></tr>');
$('#qty'+i+', #rate'+i).change(function() {
sum(i)
});
});
$(document).on('click', '.btn_remove', function(){
var button_id = $(this).attr("id");
$('#row'+button_id+'').remove();
sum_total();
});
$('#submit').click(function(){
$.ajax({
url:"name.php",
method:"POST",
data:$('#add_name').serialize(),
success:function(data)
{
alert(data);
$('#add_name')[0].reset();
}
});
});
});
$(document).ready(function() {
//this calculates values automatically
sum(0);
});
function sum(i) {
var qty1 = document.getElementById('qty'+i).value;
var rate1 = document.getElementById('rate'+i).value;
var result = parseFloat(qty1) * parseFloat(rate1);
if (!isNaN(result)) {
document.getElementById('sum'+i).value = result.toFixed(2);
}
sum_total();
}
function sum_total() {
var newTot = 0;
for (var a=0; a<=i ; a++) {
aVal = $('#sum'+a);
if (aVal && aVal.length) { newTot += aVal[0].value ? parseFloat(aVal[0].value) : 0; }
}
document.getElementById('allsum').value = newTot.toFixed(2);
}
</script>
<script>
$(document).ready(function() {
//this calculates values automatically
dueA();
$("#allsum, #pay").on("keydown keyup", function() {
dueA();
});
});
function dueA() {
var allsum = document.getElementById('allsum').value;
var pay = document.getElementById('pay').value;
var result = parseFloat(allsum)- parseFloat(pay);
if (!isNaN(result)) {
document.getElementById('dueA').value = result.toFixed(2);
}
}
</script>
Here is name.php.
<?php
require_once("config.php");
if (!isset($_SESSION["user_id"]) || $_SESSION["user_id"] == "") {
// not logged in send to login page
redirect("index.php");
}
$query = "INSERT INTO orders (date, party_name, party_address, party_ref, work_order_no, work_order_off, button_line, button_hole, button_type, logo_button, quantity, rate, amount, revised_rate, revised_amount, pro_in_no, pro_in_date, cash_bill_no, lc_sl_no, lc_no, lc_date, total_amount, pay_amount, due, mode, status) VALUES (:a, :b, :c, :d, :e, :f, :g, :h, :i, :j, :k, :l, :m, :n, :o, :p, :q, :r, :s, :t, :u, :v, :w, :x, :y, :z)";
for($count = 0; $count<count($_POST['qty']); $count++)
{
$data = array(
':a' => $_POST['date'],
':b' => $_POST['party_name'],
':c' => $_POST['party_address'],
':d' => $_POST['party_ref'],
':e' => $_POST['won'],
':f' => $_POST['woof'],
':g' => $_POST['button_line'][$count],
':h' => $_POST['button_hole'][$count],
':i' => $_POST['button_type'][$count],
':j' => $_POST['logo_button'][$count],
':k' => $_POST['qty'][$count],
':l' => $_POST['rate'][$count],
':m' => $_POST['total'][$count],
':n' => $_POST['r_rate'][$count],
':o' => $_POST['r_amount'][$count],
':p' => $_POST['pro_in_no'],
':q' => $_POST['pro_in_date'],
':r' => $_POST['cash_bill_no'],
':s' => $_POST['lc_sl_no'],
':t' => $_POST['lc_no'],
':u' => $_POST['lc_date'],
':v' => $_POST['total_amount'],
':w' => $_POST['pay_amount'],
':x' => $_POST['due'],
':y' => $_POST['mode'],
':z' => 'pending'
);
$statement = $DB->prepare($query);
$statement->execute($data);
}
header("location: orders.php");
?>

form_validation->set_rules() not working properly in code igniter

Im new to code igniter and trying to build a login and registration form in code igniter. So far login is ok but the registration form does not provide as it is needed. I followed a video tutorial but it didnt work out well. when i manually debug the code i realized that $this->form_validation->set_rules() is not working.
please help me out.
The view
<form action="<?php echo base_url();?>LoginController/Register" method="get">
<p><span id="sprytextfield1">
<label for="tn">Full Name</label>
<input class="form-control" input type="text" name="full_name" placeholder="Please Enter Your Full Name" style="width:50%" ><?php echo form_error('full_name'); ?>
<span class="textfieldRequiredMsg"> </span></span> <span id="sprytextfield2">
<label for="tjt">Designation <?php echo form_error('des'); ?><br>
<br>
<input type="radio" name="des" value="pm">
Project Manager
<input type="radio" name="des" value="ceo">
CEO<br>
<input type="radio" name="des" value="dev">
Devoloper </label>
</span></p>
<p><span> <span class="textfieldRequiredMsg"></span></span> <span id="sprytextfield3">
<label for="te">Email</label>
<input class="form-control" input type="text" name="email" placeholder="Please Enter Your Email" style="width:50%" ><?php echo form_error('email'); ?>
<span class="textfieldRequiredMsg"></span></span> <span id="sprytextfield4">
<label for="tc">Company</label>
<input class="form-control" input type="text" name="company" placeholder="Please Enter Your Company Name" style="width:50%" ><?php echo form_error('company'); ?>
<span class="textfieldRequiredMsg"></span></span> <span id="sprytextfield5">
<label for="tun">User Name</label>
<input class="form-control" input type="text" name="user_name" placeholder="Please Enter Your User Name" style="width:50%" ><?php echo form_error('user_name'); ?>
<span id="sprytextfield6">
<label for="tpw">Password</label>
<input class="form-control" input type="password" name="password" placeholder="Please Enter Your Password" style="width:50%" ><?php echo form_error('password'); ?>
<span class="textfieldRequiredMsg"></span></span> <span id="sprytextfield7">
<label for="tpw2"> Confirm Password</label>
<input class="form-control" input type="password" name="cpassword" placeholder="Please Re Enter Your Password" style="width:50%" ><?php echo form_error('cpassword'); ?>
<span class="textfieldRequiredMsg"></span></span> </p>
<table width="385" cellspacing="50px">
<tr>
<th width="75"> <button type="submit" class="btn btn-lg btn-primary"method="post">Create Account</button>
</th>
<th width="154"> <input name="Reset" type="reset" class="btn btn-lg btn-primary" >
</th>
</tr>
</table>
<p> </p>
</form>
The controller
function Register(){
$this->load->library('form_validation');
$this->load->helper(array('form', 'url'));
//Validation Rules
$this->form_validation->set_rules('full_name','Full Name','trim|required');
$this->form_validation->set_rules('email','Email Address','trim|required|valid_email|callback_check_mail_Exists');
$this->form_validation->set_rules('company','Company','trim|required');
$this->form_validation->set_rules('user_name','Username','trim|required|min_length[4]|callback_check_user_Exists');
$this->form_validation->set_rules('password','Password','trim|required|min_length[8]');
$this->form_validation->set_rules('cpassword','Password Confirmation','trim|required|matches[password]');
$this->form_validation->set_message('check_user_Exists', 'Username already exists. Please select another');
$this->form_validation->set_message('check_mail_Exists', 'E-mail already registerd.');
if($this->form_validation->run()==false){
$this->load->view('SignUp');
}else{
$this->load->model('MembershipModel');
if($this->MembershipModel->create_member()){
$data['account_created']='Your account has been created <br/><br/>';
$this->load->view('loginform',$data);
}else{
$this->load->view('SignUp');
}
}
}
the model
function create_member(){
$username=$this->input->post('user_name');
$new_member=array(
'full_name' => $this->input->post('full_name'),
'e-mail' => $this->input->post('email'),
'company' => $this->input->post('company'),
'user_name' => $this->input->post('user_name'),
'pwd' => md5($this->input->post('password')),
'designation' => $this->input->post('des')
);
$insert=$this->db->insert('user',$new_member);
return $insert;
}
function check_mail_Exists($email){
$this->db->where('e-mail',$email);
$result=$this->db->get('user');
if($result->num_rows>0){
return false;
}else{
return true;
}
}
please help me out
put method="post" in your view files
Try this
view
<!-- <form action="<?php// echo base_url();?>LoginController/Register" method='get'> -->
<?php echo form_open(base_url('LoginController/Register'),['method'=>'post'])?>
<p><span id="sprytextfield1">
<label for="tn">Full Name</label>
<input class="form-control" input type="text" name="full_name" placeholder="Please Enter Your Full Name" style="width:50%" ><?php echo form_error('full_name'); ?>
<span class="textfieldRequiredMsg"> </span></span> <span id="sprytextfield2">
<label for="tjt">Designation <?php echo form_error('des'); ?><br>
<br>
<input type="radio" name="des" value="pm">
Project Manager
<input type="radio" name="des" value="ceo">
CEO<br>
<input type="radio" name="des" value="dev">
Devoloper </label>
</span></p>
<p><span> <span class="textfieldRequiredMsg"></span></span> <span id="sprytextfield3">
<label for="te">Email</label>
<input class="form-control" input type="text" name="email" placeholder="Please Enter Your Email" style="width:50%" ><?php echo form_error('email'); ?>
<span class="textfieldRequiredMsg"></span></span> <span id="sprytextfield4">
<label for="tc">Company</label>
<input class="form-control" input type="text" name="company" placeholder="Please Enter Your Company Name" style="width:50%" ><?php echo form_error('company'); ?>
<span class="textfieldRequiredMsg"></span></span> <span id="sprytextfield5">
<label for="tun">User Name</label>
<input class="form-control" input type="text" name="user_name" placeholder="Please Enter Your User Name" style="width:50%" ><?php echo form_error('user_name'); ?>
<span id="sprytextfield6">
<label for="tpw">Password</label>
<input class="form-control" input type="password" name="password" placeholder="Please Enter Your Password" style="width:50%" ><?php echo form_error('password'); ?>
<span class="textfieldRequiredMsg"></span></span> <span id="sprytextfield7">
<label for="tpw2"> Confirm Password</label>
<input class="form-control" input type="password" name="cpassword" placeholder="Please Re Enter Your Password" style="width:50%" ><?php echo form_error('cpassword'); ?>
<span class="textfieldRequiredMsg"></span></span> </p>
<table width="385" cellspacing="50px">
<tr>
<th width="75"><button type="submit" class="btn btn-lg btn-primary">Create Account</button></a>
</th>
<th width="154"> <input name="Reset" type="reset" class="btn btn-lg btn-primary" >
</th>
</tr>
</table>
<p> </p>
</form>

display many rows using a foreach in an array

Im'y trying to do something like that but it does not work.
$resDisplayFormation is a query which returns many rows, and i need to display all the rows in my table, this file is a file called by an ajax function that's why i have to do my foreach a like that
UPDATE :
<?php
include('opendb2.php');
if(isset($_POST['idSalarie'])){
$displayFormation = $bdd->prepare('SELECT * FROM FORMATION WHERE form_id_user = :idSalarie ');
$displayFormation->bindParam(':idSalarie', $_POST['idSalarie']);
$displayFormation->execute();
$resDisplayFormation=$displayFormation->fetch(PDO::FETCH_ASSOC);
$displayForm = $bdd->prepare(
'SELECT poste_nom, ups_type_contrat, serv_nom, serv_id_resp, user_credit_cpf, user_indice_salarial, form_intitule, form_organisme, form_date, form_duree,
FLOOR( DATEDIFF( CURDATE( ) , user_dateentree ) /365 ) AS dateEntree
FROM USER
INNER JOIN USER_POSTE_SERVICE
ON USER.user_id= USER_POSTE_SERVICE.ups_poste_id
INNER JOIN POSTE
ON USER_POSTE_SERVICE. ups_poste_id = POSTE.poste_id
INNER JOIN SERVICE
ON USER_POSTE_SERVICE.ups_id_serv = SERVICE.serv_id
INNER JOIN FORMATION
ON FORMATION.form_id_user = USER.user_id
WHERE user_id = :idSalarie
ORDER BY user_nom ASC');
$displayForm->bindParam(':idSalarie', $_POST['idSalarie']);
$displayForm->execute();
$resDisplayForm=$displayForm->fetch(PDO::FETCH_ASSOC);
$data = array( 'resDisplayForm'=>'');
foreach ($resDisplayForm as $key => $value) {
$data['resDisplayForm'][$key] .= $value;
}
$data['salarie'] = '
<div class="form-group">
<label for="poste_nom" class="col-sm-2 control-label">Poste occupé</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="poste_nom" readonly>
</div>
</div>
<div class="form-group">
<label for="ups_type_contrat" class="col-sm-2 control-label">Type de contrat</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="ups_type_contrat" readonly>
</div>
</div>
<div class="form-group">
<label for="serv_nom" class="col-sm-2 control-label" readonly>Service</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="serv_nom" readonly>
</div>
</div>
<div class="form-group">
<label for="serv_id_resp" class="col-sm-2 control-label" readonly>Responsable</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="serv_id_resp" readonly>
</div>
</div>
<div class="form-group">
<label for="user_credit_cpf" class="col-sm-2 control-label" readonly>Crédits CPF</label>
<div class="col-sm-2">
<input type="text" class="form-control" name="user_credit_cpf" readonly>
</div>
<label for="user_indice_salarial" class="col-sm-2 control-label" readonly>Indice Salarial</label>
<div class="col-sm-1">
<input type="text" class="form-control" name="user_indice_salarial" readonly>
</div>
<label for="dateEntree" class="col-sm-2 control-label">Ancienneté</label>
<div class="col-sm-2 input-group">
<input type="text" class="form-control" name="dateEntree" aria-describedby="basic-addon2" readonly>
<span class="input-group-addon" id="basic-addon2">années</span>
</div>
</div>';
$data['formation'] .= '
<div class="table-responsive">
<table class="table table-bordered" style="width: auto !important;">
<thead style="font-weight: bold;">’’
<tr>
<td>N</td>
<td>Intitulé</td>
<td>Organisme</td>
<td>Date</td>
<td>Durée (en heures)</td>
<td>Eval. à chaud / à froid</td>
<td>Dispositif utilisé</td>
</tr>
</thead>
<tbody class="table-striped">';
foreach ($resDisplayFormation as $ligne) {
$data['formation'] .= '
<tr>
<td>
</td>
<td>
<input type="text" class="form-control" name="form_intitule" id="form_intitule" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_organisme" id="form_organisme" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_date" id="form_date" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_duree" id="form_duree" readonly>
</td>
<td></td>
<td></td>
</tr>';
}
$data['formation'] .= '
</tbody>
</table>
</div>';
}
echo json_encode($data);die;
?>
My AJAX :
jQuery(document).ready(function($) {
$('#idSalarie').change(function(){
//on recupere la valeur de l'attribut value pour afficher tel ou tel resultat
var req=$('#idSalarie').val();
//requête ajax, appel du fichier function.php
$.ajax({
type: "POST",
url: "lib/function.php",
data: "idSalarie="+req,
dataType : "json",
//affichage de l'erreur en cas de problème
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest + '--' + textStatus + '--' + errorThrown);
},
//function s'il n'y a pas de probleme
success:function(data){
//On affiche la réponse du serveur
$('.salarie').empty();
$('.salarie').prepend(data.salarie);
$('input[name=poste_nom]').val(data.resDisplayForm.poste_nom).val();
$('input[name=ups_type_contrat]').val(data.resDisplayForm.ups_type_contrat).val();
$('input[name=serv_nom]').val(data.resDisplayForm.serv_nom).val();
$('input[name=serv_id_resp]').val(data.resDisplayForm.serv_id_resp).val();
$('input[name=user_credit_cpf]').val(data.resDisplayForm.user_credit_cpf).val();
$('input[name=dateEntree]').val(data.resDisplayForm.dateEntree).val();
$('input[name=user_indice_salarial]').val(data.resDisplayForm.user_indice_salarial).val();
$('.formation').empty();
$('.formation').prepend(data.formation)
$('input[name=form_id]').val(data.resDisplayForm.form_id).val();
$('input[name=form_intitule]').val(data.resDisplayForm.form_intitule).val();
$('input[name=form_organisme]').val(data.resDisplayForm.form_organisme).val();
$('input[name=form_date]').val(data.resDisplayForm.form_date).val();
$('input[name=form_duree]').val(data.resDisplayForm.form_duree).val();
}
});
});
});
Inside foreach instead of
$data['formation'] = '
you had to write
$data['formation'] .= '
and after foreach you also had to write
$data['formation'] .= '
This will concatenate all of you rows in correct HTML table
UPDATE
In this part of code you didn't get any value from $ligne param and dont write it in table cells. Thats why you will get 6 identical rows
foreach ($resDisplayFormation as $ligne) {
$data['formation'] .= '
<tr>
<td>
</td>
<td>
<input type="text" class="form-control" name="form_intitule" id="form_intitule" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_organisme" id="form_organisme" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_date" id="form_date" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_duree" id="form_duree" readonly>
</td>
<td></td>
<td></td>
</tr>';
}
It should be smth like this
foreach ($resDisplayFormation as $ligne) {
$data['formation'] .= '
<tr>
<td>
</td>
<td>
<input type="text" class="form-control" name="form_intitule" id="form_intitule" value='.$ligne["form_intitule"].' readonly>
</td>
<td>
<input type="text" class="form-control" name="form_organisme" id="form_organisme" value='.$ligne["form_organisme"].' readonly>
</td>
<td>
<input type="text" class="form-control" name="form_date" id="form_date" value='.$ligne["form_date"].' readonly>
</td>
<td>
<input type="text" class="form-control" name="form_duree" id="form_duree" value='.$ligne["form_duree"].' readonly>
</td>
<td></td>
<td></td>
</tr>';
}
$data['formation'] .= '
<div class="table-responsive">
<table class="table table-bordered" style="width: auto !important;">
<thead style="font-weight: bold;">’’
<tr>
<td>N</td>
<td>Intitulé</td>
<td>Organisme</td>
<td>Date</td>
<td>Durée (en heures)</td>
<td>Eval. à chaud / à froid</td>
<td>Dispositif utilisé</td>
</tr>
</thead>
<tbody class="table-striped">';
foreach ($resDisplayFormation as $ligne) {
$data['formation'] .= '
<tr>
<td>
</td>
<td>
<input type="text" class="form-control" name="form_intitule" id="form_intitule" value="'.$ligne['form_intitule'].'" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_organisme" id="form_organisme" value="'.$ligne['form_organisme'].'" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_date" id="form_date" value="'.$ligne['form_date'].'" readonly>
</td>
<td>
<input type="text" class="form-control" name="form_duree" id="form_duree" value="'.$ligne['form_duree'].'" readonly>
</td>
<td></td>
<td></td>
</tr>';
}
$data['formation'] .= '
</tbody>
</table>
</div>';
}
echo json_encode($data); die;

insert multiple values in database

I am new to php i'm trying to insert multiple values in database.I wrote my functions but it's throwing an error.I have attached my html form below.How can i solve this...
error showing:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: itemNo
Filename: controllers/main.php
Line Number: 2406
My Code:
public function item_save(){
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("inventory", $con);
//$id_number = $_GET['id_user'];
$val1=$_GET['itemNo'];
$val2=$_GET['itemName'];
$val3=$_GET['quantity'];
$val4=$_GET['price'];
$val5=$_GET['total'];
$val6=$_GET['subTotal'];
$val7=$_GET['tax'];
$val8=$_GET['taxAmount'];
$val9=$_GET['totalAftertax'];
$val10=$_GET['amountPaid'];
$val1=$_GET['amountDue'];
$N = count($val1);
for($i=0; $i < $N; $i++)
{
mysql_query("INSERT INTO item_save(item_no,item_name,qty,price,total,subtotal,tax,tax_amount,total_final,amount_paid,amount_due) VALUES ('$val1[$i]','$val2[$i]','$val3[$i]','$val4[$i]','$val5[$i]','$val6','$val7','$val8','$val9','$val10','$val11')");
}
redirect("main/multiple");
}
form.html
<div class="container content">
<?php
echo form_open_multipart('main/item_save');
?>
<?php
$submit=array(
'name'=>'submit',
'type'=>'submit',
'class'=>'btn btn-primary',
'value'=>'Submit',
);
?>
<div class='row'>
<div class='col-xs-12 col-sm-12 col-md-12 col-lg-12'>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th width="2%"><input id="check_all" class="formcontrol" type="checkbox"/></th>
<th width="15%">Item No</th>
<th width="38%">Item Name</th>
<th width="15%">Price</th>
<th width="15%">Quantity</th>
<th width="15%">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td><input class="case" type="checkbox"/></td>
<td><input type="text" data-type="productCode" name="itemNo[]" id="itemNo_1" class="form-control autocomplete_txt" autocomplete="off"></td>
<td><input type="text" data-type="productName" name="itemName[]" id="itemName_1" class="form-control autocomplete_txt" autocomplete="off"></td>
<td><input type="number" name="price[]" id="price_1" class="form-control changesNo" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"></td>
<td><input type="number" name="quantity[]" id="quantity_1" class="form-control changesNo" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"></td>
<td><input type="number" name="total[]" id="total_1" class="form-control totalLinePrice" autocomplete="off" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class='row'>
<div class='col-xs-12 col-sm-3 col-md-3 col-lg-3'>
<button class="btn btn-danger delete" type="button">- Delete</button>
<button class="btn btn-success addmore" type="button">+ Add More</button>
</div>
<div class='col-xs-12 col-sm-offset-4 col-md-offset-4 col-lg-offset-4 col-sm-5 col-md-5 col-lg-5'>
<form class="form-inline">
<div class="form-group">
<label>Subtotal: </label>
<div class="input-group">
<div class="input-group-addon">$</div>
<input type="number" class="form-control" id="subTotal" name="subTotal" placeholder="Subtotal" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;">
</div>
</div>
<div class="form-group">
<label>Tax: </label>
<div class="input-group">
<div class="input-group-addon">$</div>
<input type="number" class="form-control" id="tax" name="tax" placeholder="Tax" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;">
</div>
</div>
<div class="form-group">
<label>Tax Amount: </label>
<div class="input-group">
<input type="number" class="form-control" id="taxAmount" name="taxAmount" placeholder="Tax" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;">
<div class="input-group-addon">%</div>
</div>
</div>
<div class="form-group">
<label>Total: </label>
<div class="input-group">
<div class="input-group-addon">$</div>
<input type="number" class="form-control" id="totalAftertax" name="totalAftertax" placeholder="Total" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;">
</div>
</div>
<div class="form-group">
<label>Amount Paid: </label>
<div class="input-group">
<div class="input-group-addon">$</div>
<input type="number" class="form-control" id="amountPaid" name="amountPaid" placeholder="Amount Paid" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;">
</div>
</div>
<div class="form-group">
<label>Amount Due: </label>
<div class="input-group">
<div class="input-group-addon">$</div>
<input type="number" class="form-control amountDue" id="amountDue" name="amountDue" placeholder="Amount Due" onkeypress="return IsNumeric(event);" ondrop="return false;" onpaste="return false;">
</div>
</div>
</form>
</div>
<?php echo form_submit($submit);?>
</div>
</div>
Notice: Undefined index: itemNo means that your $_GET['itemNo']; is not set.
You probably forgot to add &itemNo=xxx in your URL, but looking to the rest of your code you are missing itemNo[] GET parameter from form (I guess checkboxes).
EDIT:
Now, after you posted HTML, and I still don't see <form> tag, let me ask you. Are you sure you are using GET method? Because multipart forms are usually using POST method.
Check your HTML output (as source code in browser), or some network debugging and check wether it's POST or GET. I bet that it's POST, but you try to retrieve GET.
Also, you can try change $_GET to $_REQUEST (matches both GET and POST), but that's not the best idea.

Categories