Bootstrap columns not taking in print page and aligned wrongly how to rectify this issue?
I dont need responsive page but need to align the print page. Can anyone plz help me out?
#media print {
#page {
margin: 2cm;
}
.col-md-1,.col-md-2,.col-md-3,.col-md-4,
.col-md-5,.col-md-6,.col-md-7,.col-md-8,
.col-md-9,.col-md-10,.col-md-11,.col-md-12 {
float: left;
}
.col-md-1 {
width: 8%;
}
.col-md-2 {
width: 16%;
}
.col-md-3 {
width: 25%;
}
.col-md-4 {
width: 33%;
}
.col-md-5 {
width: 42%;
}
.col-md-6 {
width: 50%;
float: left;
}
.col-md-7 {
width: 58%;
}
.col-md-8 {
width: 66%;
}
.col-md-9 {
width: 75%;
}
.col-md-10 {
width: 83%;
}
.col-md-11 {
width: 92%;
}
.col-md-12 {
width: 100%;
}
}
HTML PAGE
[<div class="container border border-dark" id="container">
<div class="row">
<div style="font-size:25px; font-weight:bold; text-decoration: underline;" class="col-md-10">KERCHANSHE TRADING PLC
<div style="font-size:15px;margin-right: 5px;margin-left: 34px;"><i class="fa fa-mobile" style="font-size:18px;margin-right: 5px;" aria-hidden="true"></i> 091 121 2436
<i class="fa fa-phone" style="font-size:18px;margin-right: 5px;margin-left: 31px;" aria-hidden="true"></i> 011 371 6370</div>
<div style="font-size:15px;margin-left: 80px;">Addis Ababa, Ethiopia</div>
</div>
<div style="font-size:20px; font-weight:bold; border: 1px solid black;text-align: center;height: min-content;"
class="col-md-2 border border-dark">ORIGNAL</div>
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="MinVal">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="MaxVal">
</div>
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-4" style="margin-left: 18px;">
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroup-sizing-sm">Cert. No</span>
</div>
<input type="text" id="cert1_no" class="form-control input-sm" aria-label="Small" aria-describedby="inputGroup-sizing-sm">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-4" style="margin-left: 18px;">
<div class="input-group input-group-sm mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="inputGroup-sizing-sm">Addis Ababa</span>
</div>
<input type="text" id="addis_ababa" class="form-control input-sm" aria-label="Small" aria-describedby="inputGroup-sizing-sm">
</div>
</div>
</div>
<div class="row">
<div class="col-xl-5 col-lg-6 col-md-8 col-sm-10 mx-auto text-center form p-4">
<span style="font-size:30px; font-weight:bold; text-decoration: underline;">CERTIFICATE</span>
</div>
</div>
<span style="font-size:20px; text-decoration: underline;margin-left: 19%;">
<b>CERTIFICATE OF CLEANLINESS AND GRADE OF ETHIOPIAN COFFEE</b>
</span><br/><br/>
<div class="row">
<div class="col-md-3">
<input name="origin" type="text" class="form-control" id="origin_cert1"/>
<span style="">(Origin)</span>
</div>
<div class="col-md-9">
<span class="pull-right"> <input name="grade" type="text" class="form-control" id="grade_cert1"/>
<span style="">(Grade)</span>
</span>
</div>
</div>
<br>
<div style="font-size:15px;">
<p style="text-align: center;font-weight: 700; font-size: 18px;">Description of Lot</p>
<table class="table tablecert1 table-bordered">
<tr>
<th colspan="4" style="text-align: center;">BAGS</th>
</tr>
<tr>
<th rowspan="2" style="text-align: center;">No</th>
<th colspan="2" style="text-align: center;">Weight</th>
<th rowspan="2" style="text-align: center;">Mark</th>
</tr>
<tr>
<th style="text-align: center;">Gross</th>
<th style="text-align: center;">Net</th>
</tr>
<tr>
<td><input style="" id="no_1" class="form-control no" type="text"></td>
<td><input style="" id="gross_1" class="form-control gross" type="text"></td>
<td><input style="" id="net_1" class="form-control net" type="text"></td>
<td><input style="" id="mark_1" class="form-control mark" type="text"></td>
</tr>
<tr>
<td><input style="" id="no_2" class="form-control no" type="text"></td>
<td><input style="" id="gross_2" class="form-control gross" type="text"></td>
<td><input style="" id="net_2" class="form-control net" type="text"></td>
<td><input style="" id="mark_2" class="form-control mark" type="text"></td>
</tr>
<tr>
<td><input style="" id="no_3" class="form-control no" type="text"></td>
<td><input style="" id="gross_3" class="form-control gross" type="text"></td>
<td><input style="" id="net_3" class="form-control net" type="text"></td>
<td><input style="" id="mark_3" class="form-control mark" type="text"></td>
</tr>
<tr>
<td><input style="" id="no_4" class="form-control no" type="text"></td>
<td><input style="" id="gross_4" class="form-control gross" type="text"></td>
<td><input style="" id="net_4" class="form-control net" type="text"></td>
<td><input style="" id="mark_4"class="form-control mark" type="text"></td>
</tr>
<tr>
<td><input style="" id="no_5" class="form-control no" type="text"></td>
<td><input style="" id="gross_5" class="form-control gross" type="text"></td>
<td><input style="" id="net_5" class="form-control net" type="text"></td>
<td><input style="" id="mark_5" class="form-control mark" type="text"></td>
</tr>
<tr>
<td><input style="" id="no_6" class="form-control no" type="text"></td>
<td><input style="" id="gross_6" class="form-control gross" type="text"></td>
<td><input style="" id="net_6" class="form-control net" type="text"></td>
<td><input style="" id="mark_6" class="form-control mark" type="text"></td>
</tr>
</table>
</table>
</div>
<div class="row">
<div class="input-group mb-1 col-md-6">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Driver's Name</span>
</div>
<input type="text" class="form-control" id="driversname" aria-label="Username" aria-describedby="basic-addon1">
</div>
</div>
<div class="row">
<div class="input-group mb-1 col-md-6">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Truck Plate No.</span>
</div>
<input type="text" class="form-control" id="truckplateno" aria-label="Username" aria-describedby="basic-addon1">
</div>
</div>
<div class="row">
<div class="input-group mb-1 col-md-6">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Trailer No.</span>
</div>
<input type="text" class="form-control" id="trailerno" aria-label="Username" aria-describedby="basic-addon1">
</div>
</div>
<div class="row">
<div class="input-group mb-1 col-md-6">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Container No.</span>
</div>
<input type="text" class="form-control" id="containerno" aria-label="Username" aria-describedby="basic-addon1">
</div>
<div class="form-inline">
<label for="exampleInputEmail1" style="MARGIN-LEFT: 50PX;font-weight: 700;text-decoration:overline;">KERCHANSHE TRADING PLC</label>
</div>
</div>
<div class="row">
<div class="input-group mb-1 col-md-6">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">Seal No.</span>
</div>
<input type="text" class="form-control" id="sealno" aria-label="Username" aria-describedby="basic-addon1">
</div>
</div><br>
<div class="row">
<div class="form-group form-inline">
<label for="exampleInputEmail1" style="MARGIN-LEFT: 550PX;font-weight: 700;text-decoration:overline;">Signature of Licensed Coffee Cleaners & Graders</label>
</div>
</div>
</div>][1]
I have attached my print page please find it. And suggest me where i have to change the code in media print in css??
Actually the page should like this
real page should be like this
print wrong page looks like
print page
function printDiv_kerch() {
var divToPrint = document.getElementById('container');
var newWin = window.open('', 'Print-Window', '');
newWin.document.open();
newWin.document.write('<html><head>');
newWin.document.write('<link rel="stylesheet" type="text/css" media="print" href="http://localhost/verbat/css/certi.css"></head>');
newWin.document.write('<link rel="stylesheet" type="text/css" media="print" href="http://localhost/verbat/bootstrap-4.3.1-dist/bootstrap.min.css"></head>');
newWin.document.write('<body style="" onload="window.print();window.close();">' + divToPrint.innerHTML + '');
newWin.document.write('</body></html>');
newWin.document.close();
setTimeout(function() {
newWin.close();
}, 500);
}
Related
so im kinda new in codeigniter and web developing in general but is it possible to count Sub Total and Tax, automatically input that value into somekind of input box in codeigniter?
for example :
i have model that join some column and show the data into a table
table model.php
public function getPurchaseOrder()
{
$query =$this->db->query('SELECT dkmno, kodeprod,kodebarang_op,qty_op,unit_op,price,catatan FROM order_product JOIN barang_dkm ON order_product.kodebarang_op = barang_dkm.kodebarang');
return $query->result_array();
}
table view.php
<table class="table table-fixed table-bordered table-hover" style="width:100%;" id="tebal">
<thead>
<tr>
<th scope="col">DKM No </th>
<th scope="col">Kode Produksi </th>
<th scope="col">Kode Barang </th>
<th scope="col">Deskripsi </th>
<th scope="col">Jumlah/Quantity </th>
<th scope="col">Unit </th>
<th scope="col">Unit Price </th>
<th scope="col">Sub Total </th>
</tr>
</thead>
<tbody>
<?php foreach ($dataTabel as $kiki) : ?>
<tr class="table-row">
<td><?php echo $kiki["dkmno"]; ?></td>
<td><?php echo $kiki["kodeprod"]; ?></td>
<td><?php echo $kiki["kodebarang_op"]; ?></td>
<td><?php echo $kiki["catatan"]; ?></td>
<td><?php echo $kiki["qty_op"]; ?></td>
<td><?php echo $kiki["unit_op"]; ?></td>
<td><?php echo $kiki["price"]; ?></td>
<td class="calc"><?php $a=$kiki["qty_op"]*$kiki["price"]; echo $a ?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
and i want to count sub total from the table above and show the answer in a textbox or inputbox
subtotal, discount, and tax code if you want to know
<div class="row mt-5">
<div class="col-sm" id="kontol">
<div class="form-group">
<div class="row">
<div class="col-sm-3">
<label for="SubTotal" class="control-label">Sub Total : </label>
</div>
<div class="col-sm-9">
<input type="number" id="subTotal" name="SubTotal" value="" style="text-align: right;" class="form-control" disabled>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-3">
<label for="Discount" class="label-control" id="Discount">Discount : </label>
</div>
<div class="col-lg-3">
<div class="input-group">
<input type="number" name="Discount" class="form-control" id="inputDiscount" value="" min="0" max="100" onchange="calculatedSubTotal()"><span class="input-group-addon">%</span>
</div>
</div>
<div class="col-lg-6">
<input type="number" name="SubTotalDiscount" value="" style="text-align: right;" class="form-control" id="subTotalDiscount" disabled>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-3">
<label for="Tax" class="label-control">Tax : </label>
</div>
<div class="col-lg-3">
<div class="input-group">
<input type="number" name="Tax" value="" min="0" max="100" class="form-control" id="inputTax" onchange="calculatedSubTotal()"><span class="input-group-addon">%</span>
</div>
</div>
<div class="col-lg-6">
<input type="number" name="SubTotalTax" style="text-align: right;" class="form-control" id="subTotalTax" value="" disabled>
</div>
</div>
</div>
i have try to look at people who ask the same question but i still need somekind a detail how the model.php, controller.php, view.php, script.js work, if you need more details here's the link the ui that i already made : https://i.imgur.com/LSkrnMH.png
You could get the subtotal using CodeIgniter, but you have to use javascript to calculate the tax because it involves user interaction.
For example you have the subtotal input like this :
<div class="form-group">
<label class="col-sm-3 control-label" for="SubTotal">Sub Total</label>
<div class="col-sm-9">
<input type="number" name="SubTotal" id="subTotal" class="form-control" value="" title="Sub Total" disabled><br/>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="Discount">Discount</label>
<div class="col-sm-9">
<div class="col-sm-6">
<div class="input-group input-group-md">
<input type="number" name="Discount" id="inputDiscount" class="form-control" value="" title="Discount" min="0" max="100" onchange="calculateSubTotal()"><span class="input-group-addon">%</span>
</div>
</div>
<div class="col-sm-6">
<input type="number" name="SubTotalDiscount" id="subTotalDiscount" class="form-control" value="" title="Subtotal After Discount" disabled><br/>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="Tax">Tax</label>
<div class="col-sm-9">
<div class="col-sm-6">
<div class="input-group input-group-md">
<input type="number" name="Tax" id="inputTax" class="form-control" value="" title="Tax" min="0" max="100" onchange="calculateSubTotal()"><span class="input-group-addon">%</span>
</div>
</div>
<div class="col-sm-6">
<input type="number" name="SubTotalTax" id="subTotalTax" class="form-control" value="" title="Subtotal After Tax" disabled><br/>
</div>
</div>
</div>
Then you could set the subtotal value and also count the subtotals value after discount and after tax like this :
<script>
jQuery(function () {
let sum = 0.0;
jQuery('.calc').each(function() {
sum += parseInt(jQuery(this).text());
});
jQuery("#subTotal").val(sum);
});
function calculateSubTotal() {
let subtotal = jQuery("#subTotal").val();
jQuery("#subTotalDiscount").val(subtotal - (Math.round((jQuery("#inputDiscount").val() / 100) * subtotal)));
let subtotal_discount = jQuery("#subTotalDiscount").val();
jQuery("#subTotalTax").val(+subtotal_discount + (Math.round((jQuery("#inputTax").val() / 100) * subtotal_discount)));
}
</script>
That will set all of the subtotals using javascript instead.
Try this:
$this->db->select_sum('your_column_to_calculate');
$this->db->select('your_column_to_calculate');
$this->db->from('price');
$this->db->get();
or like this:
query = $this->db->query('SELECT sum(your_column_to_calculate) FROM price');
Hope it helps
This is javascript code,This calculate the only the calc row and show the result in subtotal text box and it will load automatically:
<script>
$(document).ready(function(){
var hh2 = 0;
$('#tebal > tbody > tr').each(function() {
var price = $(this).find('.calc').val();
hh2 += parseFloat(price);
});
$('#SubTotal').val(hh2);
});
</script>
you can count all of the sum with php itself
set variable $subtotal with zero, and add $subtotal in every loop
<?php
$subtotal = 0;
foreach ($dataTabel as $kiki) : ?>
<tr class="table-row">
....
</tr> <?php $subtotal = $subtotal+$kiki["qty_op"]*$kiki["price"]; endforeach;?>
Hope you get it.
I have a roles called read,write,and delete operation for a list of menu.I am listing menu with read,write,delete operation with a checkbox to insert to database but when i try to insert its not inserting multiple its inserting has one row in mysql here my code
database
Code
Form.php
<form method="post" action="insertuser.php" class="form-horizontal">
<fieldset>
<div class="form-group">
<label class="col-sm-2 control-label">Username</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="username" id="username" required>
<span class="help-block">Please Enter Username</span>
<span class="help-block" id="name_status"></span>
</div>
</div>
</fieldset>
<fieldset>
<div class="form-group">
<label class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" name="password" id="password" required>
<span class="help-block">Please Enter Password</span>
</div>
</div>
</fieldset>
<fieldset>
<div class="form-group">
<label class="col-sm-2 control-label">Email Address</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="emailaddress" id="emailaddress" required>
<span class="help-block">Please Enter Email Address</span>
<span class="help-block" id="name_status1"></span>
</div>
</div>
</fieldset>
<fieldset>
<div class="form-group">
<label class="col-sm-2 control-label">Role Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="rolename" id="rolename" required>
<span class="help-block">Please Enter Role Name</span>
<span class="help-block" id="name_status2"></span>
</div>
</div>
</fieldset>
<table id="example" class="table table-striped table-bordered" >
<thead>
<th data-field="id" data-sortable="true">Menu Name</th>
<th data-field="name" data-sortable="true">Read</th>
<th data-field="actions" data-sortable="true">Edit</th>
<th data-field="actions" data-sortable="true">Delete</th>
</thead>
<tbody>
<?php
$i=0;
$selectquery=mysql_query("select * from menumanagement");
while($row=mysql_fetch_array($selectquery))
{
?>
<tr>
<td><?php echo $row["mn_menuname"]; ?></td>
<td>
<label class="checkbox checkbox-inline checked">
<span class="icons"><span class="first-icon fa fa-square-o"></span><span class="second-icon fa fa-check-square-o"></span></span><input type="checkbox" name="read1[]" id="read1" value="1_<?php echo $row["mn_id"]; ?>">
</label>
</td>
<td>
<label class="checkbox checkbox-inline checked">
<span class="icons"><span class="first-icon fa fa-square-o"></span><span class="second-icon fa fa-check-square-o"></span></span><input type="checkbox" name="edit1[]" id="edit1" value="1_<?php echo $i."_".$row["mn_id"]; ?>">
</label>
</td>
<td>
<label class="checkbox checkbox-inline checked">
<span class="icons"><span class="first-icon fa fa-square-o"></span><span class="second-icon fa fa-check-square-o"></span></span><input type="checkbox" name="delete1[]" id="delete1" value="1_<?php echo $i."_".$row["mn_id"]; ?>">
</label>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<center><button type="submit" class="btn btn-fill btn-warning btn-wd" id="addmenu">Add User</button></center>
</div>
</form>
Insert.php
<?php
include_once("includes/db.php");
if(!empty($_POST["username"]))
{
$username=$_POST["username"];
}
if(!empty($_POST["password"]))
{
$password=$_POST["password"];
}
if(!empty($_POST["emailaddress"]))
{
$emailaddress=$_POST["emailaddress"];
}
$insertquery=mysql_query("insert into useraccess(useraccess_username,useraccess_password,useraccess_emailaddress) values ('$username','$password','$emailaddress')");
$userid=mysql_insert_id();
if($insertquery)
{
if(empty($_POST["read1"]))
{
$readid=0;
}
if(empty($_POST["edit1"]))
{
$editid=0;
}
if(empty($_POST["delete1"]))
{
$deleteid=0;
}
if($_POST["read1"])
{
$readid="";
$menuid="";
$countread=count($_POST["read1"]);
for($i=0;$i<$countread;$i++)
{
$read1=$_POST["read1"][$i];
$readdiv =explode("_", $read1);
$readid .=$readdiv[0];
$menuid .=$readdiv[1];
}
}
if($_POST["edit1"])
{
$editid="";
$menuid="";
$countedit=count($_POST["edit1"]);
for($i=0;$i<$countedit;$i++)
{
$edit1=$_POST["edit1"][$i];
$editdiv=explode("_", $edit1);
$editid .=$editdiv[0];
$menuid .=$editdiv[1];
}
}
if($_POST["delete1"])
{
$deleteid="";
$menuid="";
$countdelete=count($_POST["delete1"]);
for($i=0;$i<$countdelete;$i++)
{
$delete1=$_POST["delete1"][$i];
$deletediv=explode("_", $delete1);
$deleteid .=$deletediv[0];
$menuid .=$deletediv[1];
}
}
$insertquery1=mysql_query("insert into rolemanagement(menuid,role_read,role_write,role_delete,userid) value ('$menuid','$readid','$editid','$deleteid','$userid')");
if($insertquery1)
{
header('Location: adduser.php?status="Role has been added"');
}
}
?>
Regards
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.
So I have an e-newsletter popup on my website so users can stay in contact and up to date with our happenings. I only want the popup to appear on the homepage and i've put together a simple shorthand conditional statement like so:
<?php if(Mage::getSingleton('cms/page')->getPageId() == '2' && Mage::app()->getFrontController()->getRequest()->getRouteName() == 'cms') : ?>
<div id="newsletter_sign_up" style="display:none;" >
<div style="padding:20px;" >
<form action="<?php echo($this->getUrl('newsletter/subscriber/new')) ?>" method="post" >
<div class="fieldset">
<h1 style="color: #28ced7; text-align: left; font-family: Arial, Helvetica, sans-serif; font-size: 28px;">verbiage goes here</h1>
<h2 class="legend" style="text-align:left; font-family: Arial, Helvetica, sans-serif; font-size: 13px;">verbiage goes here</h2>
<!--end-->
<ul class="form-list">
<li class="fields">
<div class="customer-name">
<div class="field name-firstname">
<label class="required" for="firstname" style="text-align:left;"><em>*</em>First Name</label>
<div class="input-box">
<input type="text" class="input-text required-entry" maxlength="255" title="First Name" value="" name="firstname" id="firstname" autocomplete="off"/>
</div>
</div>
<div class="field name-lastname">
<label class="required" for="lastname" style="text-align:left;"><em>*</em>Last Name</label>
<div class="input-box">
<input type="text" class="input-text required-entry" maxlength="255" title="Last Name" value="" name="lastname" id="lastname" autocomplete="off"/>
</div>
</div>
</div>
</li>
<li>
<label class="required" for="email_address" style="text-align:left;"><em>*</em>Email Address</label>
<div class="input-box">
<input type="text" class="input-text validate-email required-entry" title="Email Address" value="" id="email_address" name="email" autocomplete="off"/>
<input class="pop_newsletter_source" name="source" type="hidden" value="3" />
</div>
</li>
</ul>
</div>
<div class="buttons-set form-buttons">
<button onclick="pop_newsletter.submit(); return false;" title="Submit" class="button" type="submit" autocomplete="off" style="position: relative; right: 140px;"><span><span>Submit</span></span></button>
</div>
<p class="required">* Required Fields</p>
<h2 style="text-align: left; font-size: 10px;">Email Privacy Statement:</h2>
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 10px; text-align: left;">more verbiage</p>
<!--//end-->
</form>
</div>
</div>
<?php endif; ?>
I've checked to verify that the page id is 2.
<?php echo "<pre>"; print_r(Mage::getSingleton('cms/page')->getPageId()); echo "</pre>"; ?>
I can't figure out why it breaks... am i missing something blatantly obvious? Any help would be appreciated.
i had form that is add some fields via jquery when i click " add new " button it will update a dom , with input fields . Input fields are using a array as a name , when i click submit button , values did not post to php, only static form values are posted but not dynamically generated input values .
My fiddle is http://jsfiddle.net/4L9Rc/
It will demonstrate clearly how is my form working .
HTML
<div class="row">
<div class="col-md-12">
<form method="POST" action="http://fabtech.com/invoices/create" accept-charset="UTF-8" role="form" class="form-horizontal re-form form-inv"><input name="_token" type="hidden" value="aLngVzB1UIlY6cEedbAh55tirXGGkYJl78BL0CRN"> <legend>Invoice Details</legend>
<div class="col-md-6">
<div class="form-group">
<label class="col-md-4 control-label">Invoice No</label>
<div class="col-md-7">
<input type="text" placeholder="Enter invoice no" class="form-control" name="inv_no" value=""">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Invoice date</label>
<div class="col-md-7">
<input type="text" placeholder="Enter text" class="form-control date-pic" name="inv_date" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Customer</label>
<div class="col-md-7">
<select class="form-control" name="inv_customer">
<option value="">- Select Customer -</option>
<option value="suresh">suresh</option>
<option value="ABC210">ABC210</option>
<option value="QWERTy123DF">QWERTy123DF</option>
<option value="CUS002">CUS002</option>
<option value="CUS0023">CUS0023</option>
<option value="CUS003">CUS003</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">PO No</label>
<div class="col-md-7">
<input type="text" placeholder="Enter text" class="form-control" name="po_no" value="">
</div> </div>
<div class="form-group">
<label class="col-md-4 control-label">PO date</label>
<div class="col-md-7">
<input type="text" placeholder="DD/MM/YYY" class="form-control date-pic" name="po_date" value="">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-md-4 control-label">Vendor code</label>
<div class="col-md-7">
<input type="text" placeholder="Enter Vendor Code" class="form-control" name="vendor_code" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">75% abatement value</label>
<div class="col-md-1">
<input type="checkbox" class="form-control sf" name="sf">
</div>
<div class="col-md-6 sfbox" style="display:none">
<input type="text" class="form-control sfboxval" readonly="">
</div> </div>
<div class="form-group">
<label class="col-md-4 control-label">25% Taxable Value</label>
<div class="col-md-1">
<input type="checkbox" class="form-control tf" name="tf">
</div>
<div class="col-md-6 tfbox" style="display:none" >
<input type="text" class="form-control tfboxval" readonly="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Tax in %</label>
<div class="col-md-7">
<input type="text" placeholder="" class="form-control tax" name="tax" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Grand Total</label>
<div class="col-md-7">
<input type="text" placeholder="" class="form-control grandtotal" readonly="" name="grand_total">
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<legend>Particulars
<a class="btn btn-xs btn-success" id="apm"><i class="icon-plus"></i> Add new</a>
</legend>
<table id="apmr" width="69%" class="table table-striped table-bordered table-hover invoice">
<thead>
<tr>
<th width="3%">SL No</th>
<th width="25%">Description</th>
<th width="8%">Unit</th>
<th width="8%">Qty</th>
<th width="10%">Unit rate</th>
<th width="9%"> Amount</th>
</tr>
</thead>
<tbody class="roo">
<tr>
<td valign="center"> 1 </td>
<td class="tr_nt"><input type="text" name="parti[1][desc]" class="part"></td>
<td class="tr_nt"><input type="text" name="parti[1][unit]" class="part"></td>
<td class="tr_qty into"><input type="text" name="parti[1][qty]" class="part qty"></td>
<td class="tr_urate into"><input type="text" name="parti[1][urate]" class="part ur"></td>
<td class="tr_amt"><input type="text" name="parti[1][amount]" readonly="" class="part tot"></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">
</td>
<td colspan="2">
Particular's Total: Rs <span class="parttotal"></span>
</td>
</tr>
</tfoot>
</table>
<p style="text-align: center;padding-top: 5px;"><input name="submit" class="btn-lg btn-primary" type="submit" value="View Invoice"></p>
</form> </div>
</div>
</div>
</div>
Javascript
//invoice particulars
var val;
$("#apm").click(function(event) {
//event.preventDefault();
//var preData = $("#apmr tr:last").html();
//console.log(preData);
//
//$("#apmr tr:last").after('<tr>' + preData + '</tr>');
var lasttd = $('.roo tr:last td:first').text();
val = parseInt(lasttd) + 1;
$(".roo tr:last").after(' <tr> <td valign="center"> ' + val + ' </td> <td class="tr_nt"><input type="text" name="parti[' + val + '][desc]" class="part"></td> <td class="tr_nt"><input type="text" name="parti[' + val + '][unit]" class="part"></td> <td class="tr_qty into"><input type="text" name="parti[' + val + '][qty]" class="part qty"></td> <td class="tr_urate into"><input type="text" name="parti[' + val + '][urate]" class="part ur"></td> <td class="tr_amt"><input type="text" name="parti[' + val + '][amount]" readonly class="part tot" ></td></tr>');
// val = val + 1;
return false;
})
var gt;
$("table.invoice").on("change", '.qty, .ur', function(event) {
calculateRow($(this).closest("tr"));
calculateTotal();
});
function calculateRow(row) {
var price = +row.find('.qty').val();
var qty = +row.find('.ur').val();
row.find('.tot').val((price * qty).toFixed(2));
}
function calculateTotal() {
var Total = 0;
$("table.invoice").find('.tot').each(function() {
Total += +$(this).val();
});
$(".parttotal").text(Total.toFixed(2));
calgrand();
}
$(".re-form").on('change', '.tax,.tf,.sf', function(event) {
calgrand();
})
function calgrand() {
var taxVal = $('.tax').val();
var parVal = $(".parttotal").text();
var result = parVal - taxVal * parVal / 100;
$('.grandtotal').val(result.toFixed(2));
if ($('.tf').is(':checked')) {
var resulttf = parVal - 25 * parVal / 100;
$('.tfboxval').val(resulttf.toFixed(2));
var result = result - resulttf;
$('.grandtotal').val(result.toFixed(2));
}
if ($('.sf').is(':checked')) {
//alert('entered');
var resultsf = parVal - 75 * parVal / 100;
$('.sfboxval').val(resultsf.toFixed(2));
var result = result - resultsf;
$('.grandtotal').val(result.toFixed(2));
}
}
$('.tf').click(function() {
$(".tfbox").toggle(this.checked);
});
$('.sf').click(function() {
$(".sfbox").toggle(this.checked);
});
in php i had
print_r($_POST['parti']);
its give out put
Array
(
[1] => Array
(
[desc] =>
[unit] =>
[qty] =>
[urate] =>
[amount] =>
)
)
but i need
Array
(
[1] => Array
(
[desc] =>
[unit] =>
[qty] =>
[urate] =>
[amount] =>
)
[2] => Array
(
[desc] =>
[unit] =>
[qty] =>
[urate] =>
[amount] =>
)
[3] => Array
(
[desc] =>
[unit] =>
[qty] =>
[urate] =>
[amount] =>
)
....
)
javascript
Please indent your code next time. Too many changes to make in your form. At the line where you have "Enter invoice no." you have left an open quote at value=""" which is a big mistake.
Overwrite your HTML code with this:
<div class="matter">
<div class="container">
<form method="POST" action="http://fabtech.com/invoices/create" accept-charset="UTF-8" role="form" class="form-horizontal re-form form-inv">
<input name="_token" type="hidden" value="aLngVzB1UIlY6cEedbAh55tirXGGkYJl78BL0CRN">
<div class="row">
<div class="col-md-12">
<legend>Invoice Details</legend>
<div class="col-md-6">
<div class="form-group">
<label class="col-md-4 control-label">Invoice No</label>
<div class="col-md-7">
<input type="text" placeholder="Enter invoice no" class="form-control" name="inv_no" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Invoice date</label>
<div class="col-md-7">
<input type="text" placeholder="Enter text" class="form-control date-pic" name="inv_date" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Customer</label>
<div class="col-md-7">
<select class="form-control" name="inv_customer">
<option value="">- Select Customer -</option>
<option value="suresh">suresh</option>
<option value="ABC210">ABC210</option>
<option value="QWERTy123DF">QWERTy123DF</option>
<option value="CUS002">CUS002</option>
<option value="CUS0023">CUS0023</option>
<option value="CUS003">CUS003</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">PO No</label>
<div class="col-md-7">
<input type="text" placeholder="Enter text" class="form-control" name="po_no" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">PO date</label>
<div class="col-md-7">
<input type="text" placeholder="DD/MM/YYY" class="form-control date-pic" name="po_date" value="">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-md-4 control-label">Vendor code</label>
<div class="col-md-7">
<input type="text" placeholder="Enter Vendor Code" class="form-control" name="vendor_code" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">75% abatement value</label>
<div class="col-md-1">
<input type="checkbox" class="form-control sf" name="sf">
</div>
<div class="col-md-6 sfbox" style="display:none">
<input type="text" class="form-control sfboxval" readonly="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">25% Taxable Value</label>
<div class="col-md-1">
<input type="checkbox" class="form-control tf" name="tf">
</div>
<div class="col-md-6 tfbox" style="display:none">
<input type="text" class="form-control tfboxval" readonly="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Tax in %</label>
<div class="col-md-7">
<input type="text" placeholder="" class="form-control tax" name="tax" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Grand Total</label>
<div class="col-md-7">
<input type="text" placeholder="" class="form-control grandtotal" readonly="" name="grand_total">
</div>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<legend>Particulars <a class="btn btn-xs btn-success" id="apm"><i class="icon-plus"></i> Add new</a>
</legend>
<table id="apmr" width="69%" class="table table-striped table-bordered table-hover invoice">
<thead>
<tr>
<th width="3%">
SL No
</th>
<th width="25%">
Description
</th>
<th width="8%">
Unit
</th>
<th width="8%">
Qty
</th>
<th width="10%">
Unit rate
</th>
<th width="9%">
Amount
</th>
</tr>
</thead>
<tbody class="roo">
<tr>
<td valign="center">
1
</td>
<td class="tr_nt">
<input type="text" name="parti[1][desc]" class="part">
</td>
<td class="tr_nt">
<input type="text" name="parti[1][unit]" class="part">
</td>
<td class="tr_qty into">
<input type="text" name="parti[1][qty]" class="part qty">
</td>
<td class="tr_urate into">
<input type="text" name="parti[1][urate]" class="part ur">
</td>
<td class="tr_amt">
<input type="text" name="parti[1][amount]" readonly="" class="part tot">
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">
</td>
<td colspan="2">
Particular's Total: Rs <span class="parttotal"></span>
</td>
</tr>
</tfoot>
</table>
<p style="text-align: center;padding-top: 5px;">
<input name="submit" class="btn-lg btn-primary" type="submit" value="View Invoice">
</p>
</div>
</div>
</form>
</div>
</div>
Your mistake was that your <form> tag was closed in the wrong place. Remember to always place tags in such a way that always the inner tags close first.