I am trying to insert data into the database and my code does add a new row but all the values are null. I don't know what's causing it. The view is inside a modal in html. Here's my code: Thanks for your help
Controller:
public function addItem(){
$save = array(
'inventoryID' => $this->input->post('rfid'),
'masterCode' => $this->input->post('masterCode'),
'itemName' => $this->input->post('itemName'),
'colorName' => $this->input->post('colorName'),
'location' => $this->input->post('location'),
'itemCategory' => $this->input->post('itemCategory'),
'materialDescription' => $this->input->post('materialDescription'),
'supplier' => $this->input->post('supplier'),
'itemDescription' => $this->input->post('itemDescription'),
'comments' => $this->input->post('comments'),
'itemCode' => $this->input->post('itemCode'),
'colorCode' => $this->input->post('colorCode')
);
$this->searchModel->form_insert($save);
//load the header
$this->load->view('base.php',$save);
//load the page
redirect('Search');
//load the footer
$this->load->view('footer.php',$save);
}
Model:
function form_insert($data){
// Inserting in Table(inventory) of Database(library)
$this->load->database();
$this->db->insert('inventory', $data);
$inventoryID = $this->db->insert_id();
}
View:
<div id="addItem" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form method ="post" action= "<?php echo site_url("Search/addItem"); ?>">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add an Item</h4>
</div>
<div class="modal-body">
<form role="form">
<table>
<tr>
<td><input type="text" name="rfid" placeholder="RFID" required/></td>
<td><input type="text" name="itemCode" placeholder="Item Code" required/></td>
<td><input type="text" name="masterCode" placeholder="Master Code" /></td>
</tr>
<tr>
<td><input type="text" name="itemName" placeholder="Item Name" required/></td>
<td><input type="text" name="colorCode" placeholder="Color Code" /></td>
<td><input type="text" name="colorName" placeholder="Color Name" /></td>
</tr>
<tr>
<td><input type="text" name="location" placeholder="Location" required/></td>
<td><input type="text" name="makelocation" placeholder="Location Made" required/></td>
<td><input type="text" name="itemCategory" placeholder="Item Category" /></td>
</tr>
<tr>
<td><input type="text" name="materialDescription" placeholder="Material Description" /></td>
<td><input type="text" name="supplier" placeholder="Supplier/Vendor" required/></td>
<td><input type="text" name="checkoutAllowed" placeholder="Checkout Allowed" /></td>
</tr>
</table>
<div class="row personal-info">
<div class="col-sm-4">
<div class="form-group">
<textarea name="itemDescription" placeholder="Insert information regarding the weather this item is suitable for and where it is used"></textarea>
<textarea name="Comments" placeholder="Additional Coments on the Item"></textarea>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer" style="text-align:center;">
<input class="btn btn-primary" name="addItem" value="Add Item">
</div>
</form>
</div>
</div>
</div>
The problem is that you do not actually "submit" the form data. Your button links to the correct controller/method but does not send any data to the controller when you use a link, i.e. <a href=.... You need a submit button.
The change is quite simple. Change the code for the button as follows.
<div class="modal-footer" style="text-align:center;">
<input type="submit" class="btn btn-primary" name="addItem" value="Add Item">
</div>
There is another issue. You have two <form> tags.
Remove the line
<form method ="post" action="<?php echo site_url("Search/addItem"); ?>">
And change the line
<form role="form">
to
<form method="post" action="<?php echo site_url("Search/addItem"); ?>" role="form">
You also need to remove the extra form close tag two lines above the button's code. Nested <form>s are not allowed. And you need to move the closing tag for <div class="modal-content"> So to make it more clear here is what your view should finally look like.
<div id="addItem" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Add an Item</h4>
</div>
<div class="modal-body">
<form method ="post" action= "<?php echo site_url("Search/addItem"); ?>" role="form">
<table>
<tr>
<td><input type="text" name="rfid" placeholder="RFID" required/></td>
<td><input type="text" name="itemCode" placeholder="Item Code" required/></td>
<td><input type="text" name="masterCode" placeholder="Master Code" /></td>
</tr>
<tr>
<td><input type="text" name="itemName" placeholder="Item Name" required/></td>
<td><input type="text" name="colorCode" placeholder="Color Code" /></td>
<td><input type="text" name="colorName" placeholder="Color Name" /></td>
</tr>
<tr>
<td><input type="text" name="location" placeholder="Location" required/></td>
<td><input type="text" name="makelocation" placeholder="Location Made" required/></td>
<td><input type="text" name="itemCategory" placeholder="Item Category" /></td>
</tr>
<tr>
<td><input type="text" name="materialDescription" placeholder="Material Description" /></td>
<td><input type="text" name="supplier" placeholder="Supplier/Vendor" required/></td>
<td><input type="text" name="checkoutAllowed" placeholder="Checkout Allowed" /></td>
</tr>
</table>
<div class="row personal-info">
<div class="col-sm-4">
<div class="form-group">
<textarea name="itemDescription" placeholder="Insert information regarding the weather this item is suitable for and where it is used"></textarea>
<textarea name="Comments" placeholder="Additional Coments on the Item"></textarea>
</div>
</div>
</div>
<div class="modal-footer" style="text-align:center;">
<input type="submit" class="btn btn-primary" name="addItem" value="Add Item">
</div>
</form>
</div>
</div>
</div>
</div>
Related
I am trying to show bootstrap modal message using ajax in php. I can get alert message under ajax but not modal. When I use ajax inside javascript. It worked but with same structure, it is not working now. I think it has to do with submit button. I set type for button tag to submit for html 5 validation. but it doesn't cooperate well with bootstrap modal. When I change type to button modal works but html5 does't work. Is there any way to resolve this issue? I have spent so many hours now but no luck. Any help would be appreciated. Thank you in adavanced.
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/shop-homepage.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/mystyle.css">
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(function(){
$('#submit').click(function(){
if($("form")[0].checkValidity()) {
var params = jQuery("#frm").serialize();
jQuery.ajax({
url:'join_process.php',
type:'POST',
data:params,
dataType:"text",
error:function(){
alert('join fails!');
},
success:function(data){
if(data==true){
alert("test");
$('.modal-body').html("<center>member join success</center>");
// Display Modal
$('#empModal').modal('show');
// Add response in Modal body
}else{
$('.modal-body1').html(data);
// Display Modal
$('#empModal1').modal('show');
}
}
});
}else{ console.log("invalid form");}
});
});
</script>
</head>
<body>
<?php
headerNav();
?>
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-3">
<?php
sideMenu();
?>
</div>
<!-- /.col-lg-3 -->
<div class="col-lg-9 text-center mt-1">
<?php
// $bookinfo= get_book_info($new);
?>
<br/>
<div class="row">
<div class="col-lg-3"></div>
<div class="col-lg-6">
<table class="table table-bordered text-center" id="test">
<form id="frm">
<tr>
<th colspan="2" bgcolor="#d2e6f7">Membership</th>
</tr>
<tr>
<td><label for="name">name:</label></td>
<td style="text-align:left;"><input type="text"
id="name" name="name" value="" maxlength="20" size="20" required/></tr>
<tr>
<td><label for="id">id:</label></td>
<td style="text-align:left;"><input type="text"
id="id" name="id" value="" maxlength="20" size="20" required/>
<div id="id_chk"></div>
</tr>
<tr>
<td><label for="pass">password:</label></td>
<td style="text-align:left;"><input type="password"
id="pass" name="pass" maxlength="20" size="20" required/></td>
</tr>
<td><label for="pass_confirm">password confirm:</label></td>
<td style="text-align:left;"><input type="password"
id="pass_confrm" name="pass_confrm" maxlength="20" size="20" required/></td>
</tr>
<tr>
<td><label for="email">email:</label></td>
<td style="text-align:left;"><input type="email"
id="email" name="email" value="" maxlength="20" size="20" required/></tr>
<tr>
<td><label for="addr">address:</label></td>
<td style="text-align:left;"><input type="text"
id="addr" name="addr" value="" maxlength="20" size="20" required/></tr>
<tr>
<td><label for="cellphone">cellphone:</label></td>
<td style="text-align:left;">
<input type="tel" id="cellphone" name="cellphone"
placeholder="01091112333" required>
</td>
</tr>
<tr>
<td>Want to be administrator:</td>
<td style="text-align:left;"><input type="radio"
name="isadmin" value="Y">
<label for="y">Yes</label>
<input type="radio" name="isadmin" value="N" checked>
<label for="n">No</label>
</tr>
<tr>
<td colspan='2'>
<button type="submit" id="submit" class="btn btn-
primary">가입</button>
</td>
</tr>
</form>
</table>
<!-- Modal -->
<div class="modal fade" id="empModal1" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="close" data-dismiss="modal"
id="close">×</button>
</div>
<div class="modal-body1">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="empModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="close" data-dismiss="modal" id="close"
onclick="location.href='index.php'">×</button>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"
onclick="location.href='index.php'">Close</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-3"></div>
</div>
</div>
</div>
</div>
I am making a simple add of items to inventory software which gets the data and adds to database using dynamic inputs.
<div class="col-lg-6">
<form action="invoice_check.php" method="POST">
<div class="row">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-medicines">
<thead>
<tr>
<th>Name</th>
<th>MFR</th>
<th>Quantity</th>
<th>Batch</th>
<th>Expiry</th>
<th>MRP</th>
<th>DSC</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td style="width:20%;"><div class="form-group"><input id="1" class="form-
control" placeholder="Name" type="text" name="mname[]"></input></div></td>
<td><div class="form-group"><input class="form-control"
placeholder="Manufacturer" name="mfg[]"></div></td>
<td style="width:10%;"><div class="form-group"><input class="form-control"
placeholder="Qty" name="qty[]"></div></td>
<td style="width:10%;"><div class="form-group"><input class="form-control"
placeholder="Batch" name="batch[]"></div></td>
<td><div class="form-group"><input class="form-control" placeholder="MM/YY"
id="cc" name="exp[]"></div></td>
<td style="width:10%;"><div class="form-group"><input class="form-control"
placeholder="MRP" name="mrp[]"></div></td>
<td style="width:10%;"><div class="form-group"><input class="form-control"
placeholder="DSC" name="dsc[]"></div></td>
<td>
-
</td>
</tr>
</tbody>
</table>
</div>
</div>
<input type="submit" class="btn btn-primary btn-lg btn-block">
</form>
I have the following jquery for adding the a new Which contains the new input set.
The problem is that although the row gets added, when submitted the array doesn't contain the data of the appended input items.
For example, how many ever inputs i add, that data is never recorded even though I have used the array for the inputs.
I know the scripting of array isn't an issue since I have tried by using the same code as another without adding by jquery and the array has recorded the data.
<script>
$(document).ready(function() {
var wrapper = $(".table-medicines"); //Fields wrapper
var add_button = $(".add_field_button"); //Add button ID
var x=1;
$(add_button).click(function(e){ //on add input button click
e.preventDefault();
x++;
$(wrapper).append('<tr> <td><div class="form-group"><input class="form-control" id="'+x+'" placeholder="Name" type="text" name="mname[]"/></div></td> <td><div class="form-group"><input class="form-control" placeholder="Manufacturer" name="mfg[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="Qty" name="qty[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="Batch" name="batch[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="Expiry" name="exp[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="MRP" name="mrp[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="DSC" name="dsc[]"></div></td> <td> <button type="button" class="add_field_button btn btn-danger btn-circle"><i class="fa fa-times "></i></button> </td> </tr>'); //add input box
});
$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
e.preventDefault(); $(this).closest('tr').remove(); x--;
})
});
Thanks in advance.
At first, when the DOM is loading, you won't get the Add new button as it is generating inside its self click event. So you have to initialize it on loading. Rest of the things are correct except few minor changes.
$(document).ready(function() {
var wrapper = $(".table-medicines"); //Fields wrapper
var add_button = $(".add_field_button"); //Add button ID
var x=1;
$(add_button).click(function(e){ //on add input button click
e.preventDefault();
x++;
$(wrapper).append('<tr> <td><div class="form-group"><input class="form-control" id="'+x+'" placeholder="Name" type="text" name="mname[]"/></div></td> <td><div class="form-group"><input class="form-control" placeholder="Manufacturer" name="mfg[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="Qty" name="qty[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="Batch" name="batch[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="Expiry" name="exp[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="MRP" name="mrp[]"></div></td> <td><div class="form-group"><input class="form-control" placeholder="DSC" name="dsc[]"></div></td> <td> <button type="button" class="remove_field btn btn-danger btn-circle"><i class="fa fa-times "></i>Remove</button></td> </tr>'); //add input box
});
$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
e.preventDefault(); $(this).closest('tr').remove(); x--;
})
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div class="col-lg-6">
<form action="invoice_check.php" method="POST">
<div class="row">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-medicines">
<thead>
<tr>
<th>Name</th>
<th>MFR</th>
<th>Quantity</th>
<th>Batch</th>
<th>Expiry</th>
<th>MRP</th>
<th>DSC</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td style="width:20%;">
<div class="form-group"><input id="1" class="form-
control" placeholder="Name" type="text" name="mname[]"></input></div>
</td>
<td>
<div class="form-group"><input class="form-control"
placeholder="Manufacturer" name="mfg[]"></div>
</td>
<td style="width:10%;">
<div class="form-group"><input class="form-control"
placeholder="Qty" name="qty[]"></div>
</td>
<td style="width:10%;">
<div class="form-group"><input class="form-control"
placeholder="Batch" name="batch[]"></div>
</td>
<td>
<div class="form-group"><input class="form-control" placeholder="MM/YY"
id="cc" name="exp[]"></div>
</td>
<td style="width:10%;">
<div class="form-group"><input class="form-control"
placeholder="MRP" name="mrp[]"></div>
</td>
<td style="width:10%;">
<div class="form-group"><input class="form-control"
placeholder="DSC" name="dsc[]"></div>
</td>
<td><button type="button" class="add_field_button btn btn-danger btn-circle"><i class="fa fa-times "></i>Add</button> </td>
</tr>
</tbody>
</table>
</div>
</div>
<input type="submit" class="btn btn-primary btn-lg btn-block">
</form>
i have problem at the time of input data to the database
this is error message
A Database Error Occurred
Error Number: 1048
Column 'username_member' cannot be null
INSERT INTO member (id_member, username_member,
password_member, nama_member, jk_member, hp_member,
alamat_member, email_member) VALUES (NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL)
Filename: C:/AppServ/www/PROJEK/system/database/DB_driver.php
Line Number: 691
my controller
function tambah()
{
$data = array(
'aksi' => site_url('member/tambah_aksi'),
'id_member' => set_value('id_member'),
'username_member' => set_value('username_member'),
'password_member' => set_value('password_member'),
'nama_member' => set_value('nama_member'),
'jk_member' => set_value('jk_member'),
'hp_member' => set_value('hp_member'),
'alamat_member' => set_value('alamat_member'),
'email_member' => set_value('email_member'),
'button' => 'DAFTAR'
);
$this->load->view('Utama/member_form', $data);
}
function tambah_aksi()
{
$data = array(
'id_member' => $this->input->post('id_member'),
'username_member' => $this->input->post('username_member'),
'password_member' => $this->input->post('password_member'),
'nama_member' => $this->input->post('nama_member'),
'jk_member' => $this->input->post('jk_member'),
'hp_member' => $this->input->post('hp_member'),
'alamat_member' => $this->input->post('alamat_member'),
'email_member' => $this->input->post('email_member')
);
$this->member_model->tambah_data($data);
redirect('Login_member');
}
View
<h3> FORM <i class="icon-arrow-left"></i> LANJUT BERBELANJA </h3> <hr class="soft"/> <table class="table table-bordered">
<tr><th> FORM DAFTAR MEMBER </th></tr>
<form action="<?php echo $aksi; ?>" method="get" class="form-horizontal" enctype="multipart/form-data">
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputUsername">Username</label>
<div class="controls">
</td>
<td>
<input type="text" name="username_member" class="form-control" placeholder="Inputkan Username" value="">
</div>
</div>
</td>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputPassword1">Password</label>
<div class="controls">
</td>
<td>
<input type="password" name="password_member" placeholder="Password" value="">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputPassword1">Nama Member</label>
<div class="controls">
</td>
<td>
<input type="text" name="nama_member" placeholder="ex : Eden Hazard" value="">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputPassword1">Jenis Kelamin</label>
<div class="controls">
</td>
<td>
<input type="radio" name="jk_member" value="Laki">Pria
<br>
<input type="radio" name="jk_member" value="Wanita">Wanita
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputPassword1">No Hp</label>
<div class="controls">
</td>
<td>
<input type="text" name="hp_member" placeholder="ex : 08127516331" value="">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputPassword1">Alamat Lengkap</label>
<div class="controls">
</td>
<td>
<input type="text" name="alamat_member" placeholder="ex : perum pandau blok c.19 no.16, Pekanbaru, Riau" value="">
</div>
</div>
</td>
</tr>
<tr>
<td>
<div class="control-group">
<label class="control-label" for="inputPassword1">Email</label>
<div class="controls">
</td>
<td>
<input type="text" name="email_member" placeholder="ex : randy#yahoo.com" value="">
</div>
</div>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="id_member" value="<?php echo $id_member; ?>">
<button class="btn btn-primary" type="submit"><?php echo $button; ?></button>
</td>
</tr>
</form>
You want to change your forms method from get to post as you are processing POST data.
So your line
<form action="<?php echo $aksi; ?>" method="get" class="form-horizontal" enctype="multipart/form-data">
Change the get to post for your method.
<form action="<?php echo $aksi; ?>" method="post" class="form-horizontal" enctype="multipart/form-data">
See how that flies.
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.
I want to change the format of date which is showing on text box after choosing dates. I tried format table and other coding found in Google but it doesn't work.
<form action="report_emp.php" method="post">
<input name="id" type="hidden" value="<?php echo $_GET['id'];?>">
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<tbody>
<tr>
<td>From</td>
<td>
<div class="control-group">
<label class="control-label" for="date01">Date</label>
<div class="controls">
<input type="text" class="input-xlarge datepicker" id="date01" name="datefrom" value="mm/dd/yy">
</div>
</div>
</td>
<td>To</td>
<td>
<div class="control-group">
<label class="control-label" for="date02">Date</label>
<div class="controls">
<input type="text" class="input-xlarge datepicker" id="date02" name="dateto" value="mm/dd/yy">
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Find Client Details</button>
<button class="btn">Cancel</button>
</div>
</form>
If you are talking about jquery datepicker, then you can use:
$( "#datepicker" ).datepicker( "option", "dateFormat", "mm/dd/yy" );
Check here.