I have problem in using this long sourcecode. Is there any substitute code or condition statement to shorten or minimize the code. I use the if-ElseIf Statement. Thank you!
I actually doing a system regarding on multiple conditions regarding on the specified amount. Ex. If SHARE equal or less than 30,000 their is a specified percentage computed with different months.
<div class="span8" align="center">
<table width="100%">
<tr>
<td align="center" width="50%">
<form action="" method="POST">
<label> *NOTE: Php.36,000.00 - maximum applied loanable amount</label>
<br/>
<label>Share Capital:</label>
<input onBlur="this.value=formatCurrency(this.value)" type="hidden">
<input type="text" name="share" value="0" class="textbox"/><br>
<label>Term:</label>
<select name="terms"/>
<option value="1">1 Month</option>
<option value="2">2 Months</option>
</select> <br />
<input type="submit" name="calculate" class="btn btn-success" value="Let's COMPUTE">
</form></td>
<td width="50%" align="justify" >
<div class="alert alert-info" align="justify" style="font-size:16px">
<?php if(isset($_POST['calculate'])) {
$share = $_POST['share'];
$terms = $_POST['terms'];
?>
<?php if($share <= "30000"){ ?>
<?php if($terms == "1"){
$interest = $share * .0130;
$service_fee = $share * .01;
$filling_fee = 30;
$cash_on_hand = $share - ($service_fee + $interest + $filling_fee);
$loan_receivable = $cash_on_hand + $service_fee + $interest + $filling_fee;
$debit = $loan_receivable;
$credit = $interest + $service_fee + $filling_fee + $cash_on_hand;
?>
<table width="100%">
<tr>
<td width="40%" align="justify"><?php echo "Loan Receivable"; ?></td>
<td width="30%" align="right"><?php echo number_format($loan_receivable, 2); ?> </td>
<td width="30%" align="right"> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Interest "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($interest, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Service Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($service_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Filling Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($filling_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Cash On Hand "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($cash_on_hand, 2); ?></td>
</tr>
<tr bgcolor="#CCCCCC" style="color:#000000; font-weight:bold">
<td width="40%" align="right"><?php echo "TOTAL "; ?></td>
<td width="30%" align="right"><?php echo number_format($debit, 2); ?></td>
<td width="30%" align="right"><?php echo number_format($credit, 2); ?></td>
</tr>
<tr>
<td><br/><br/></td>
<td><br/><br/></td>
<td><br/><br/></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Applied Loan "; ?></td>
<td width="30%" align="right"><?php echo number_format($share, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Term: "; ?></td>
<td width="30%" align="right"><?php echo $terms. " month "; ?> </td>
</tr>
</table>
<?php } elseif($terms == "2"){
$interest = $share * .0195;
$service_fee = $share * .01;
$filling_fee = 30;
$cash_on_hand = $share - ($service_fee + $interest + $filling_fee);
$loan_receivable = $cash_on_hand + $service_fee + $interest + $filling_fee;
$debit = $loan_receivable;
$credit = $interest + $service_fee + $filling_fee + $cash_on_hand;
?>
<table width="100%">
<tr>
<td width="40%" align="justify"><?php echo "Loan Receivable"; ?></td>
<td width="30%" align="right"><?php echo number_format($loan_receivable, 2); ?> </td>
<td width="30%" align="right"> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Interest "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($interest, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Service Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($service_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Filling Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($filling_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Cash On Hand "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($cash_on_hand, 2); ?></td>
</tr>
<tr bgcolor="#CCCCCC" style="color:#000000; font-weight:bold">
<td width="40%" align="right"><?php echo "TOTAL "; ?></td>
<td width="30%" align="right"><?php echo number_format($debit, 2); ?></td>
<td width="30%" align="right"><?php echo number_format($credit, 2); ?></td>
</tr>
<tr>
<td><br/><br/></td>
<td><br/><br/></td>
<td><br/><br/></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Applied Loan "; ?></td>
<td width="30%" align="right"><?php echo number_format($share, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Term: "; ?></td>
<td width="30%" align="right"><?php echo $terms. " months "; ?> </td>
</tr>
</table>
<!--END OF SHARE 30,000 BELOW --> <?php } ?>
<!--START OF SHARE 30,000 ABOVE --> <?php } elseif($share >= "30001"){ ?>
<?php if($terms == "1"){
$interest = $share * .0130;
$service_fee = $share * .01;
$filling_fee = 30;
$cash_on_hand = $share - ($service_fee + $interest + $filling_fee);
$loan_receivable = $cash_on_hand + $service_fee + $interest + $filling_fee;
$debit = $loan_receivable;
$credit = $interest + $service_fee + $filling_fee + $cash_on_hand;
?>
<table width="100%">
<tr>
<td width="40%" align="justify"><?php echo "Loan Receivable"; ?></td>
<td width="30%" align="right"><?php echo number_format($loan_receivable, 2); ?> </td>
<td width="30%" align="right"> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Interest "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($interest, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Service Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($service_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Filling Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($filling_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Cash On Hand "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($cash_on_hand, 2); ?></td>
</tr>
<tr bgcolor="#CCCCCC" style="color:#000000; font-weight:bold">
<td width="40%" align="right"><?php echo "TOTAL "; ?></td>
<td width="30%" align="right"><?php echo number_format($debit, 2); ?></td>
<td width="30%" align="right"><?php echo number_format($credit, 2); ?></td>
</tr>
<tr>
<td><br/><br/></td>
<td><br/><br/></td>
<td><br/><br/></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Applied Loan "; ?></td>
<td width="30%" align="right"><?php echo number_format($share, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Term: "; ?></td>
<td width="30%" align="right"><?php echo $terms. " month "; ?> </td>
</tr>
</table>
<?php } elseif($terms == "2"){
$interest = $share * .0205;
$service_fee = $share * .01;
$filling_fee = 30;
$cash_on_hand = $share - ($service_fee + $interest + $filling_fee);
$loan_receivable = $cash_on_hand + $service_fee + $interest + $filling_fee;
$debit = $loan_receivable;
$credit = $interest + $service_fee + $filling_fee + $cash_on_hand;
?>
<table width="100%">
<tr>
<td width="40%" align="justify"><?php echo "Loan Receivable"; ?></td>
<td width="30%" align="right"><?php echo number_format($loan_receivable, 2); ?> </td>
<td width="30%" align="right"> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Interest "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($interest, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Service Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($service_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Filling Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($filling_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Cash On Hand "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($cash_on_hand, 2); ?></td>
</tr>
<tr bgcolor="#CCCCCC" style="color:#000000; font-weight:bold">
<td width="40%" align="right"><?php echo "TOTAL "; ?></td>
<td width="30%" align="right"><?php echo number_format($debit, 2); ?></td>
<td width="30%" align="right"><?php echo number_format($credit, 2); ?></td>
</tr>
<tr>
<td><br/><br/></td>
<td><br/><br/></td>
<td><br/><br/></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Applied Loan "; ?></td>
<td width="30%" align="right"><?php echo number_format($share, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Term: "; ?></td>
<td width="30%" align="right"><?php echo $terms. " months "; ?> </td>
</tr>
</table>
<?php } ?>
<?php } ?>
<?php } ?>
</div> </td>
</tr>
</table>
I think what you could do here is create a function (or have this as part of a set of tools saved in a class) that you can make available for reuse via an include(). To mix the algorithm into your html will severely limit it's possible use elsewhere. It also clutters up your html output when you intersperse it. Creating a function/class->method allows for expandability and porting into other functions/class->methods as well:
<?php
// Create a function that can accept parameters
function CalculateItem($share = 0,$terms = 0)
{
if($share <= 30000)
$multiplier = ($terms == "1")? .0130 : .0195;
elseif($share >= 30001)
$multiplier = ($terms == "1")? .0130 : .0205;
if(empty($multiplier))
return;
$data['share'] = $share;
$data['terms'] = $terms;
$data['interest'] = ($share * $multiplier);
$data['service_fee'] = ($share * .01);
$data['filling_fee'] = 30;
$data['cash_on_hand'] = $share - ($data['service_fee'] + $data['interest'] + $data['filling_fee']);
$data['loan_receivable'] = $data['cash_on_hand'] + $data['service_fee'] + $data['interest'] + $data['filling_fee'];
$data['debit'] = $data['loan_receivable'];
$data['credit'] = $data['interest'] + $data['service_fee'] + $data['filling_fee'] + $data['cash_on_hand'];
return $data;
}
// Get the state of data. Anything but false will trigger the breakout table
$data = (isset($_POST['calculate']))? CalculateItem($_POST['share'],$_POST['terms']) : false;
?>
<div class="span8" align="center">
<table width="100%">
<tr>
<td align="center" width="50%">
<form action="" method="POST">
<label> *NOTE: Php.36,000.00 - maximum applied loanable amount</label>
<br/>
<label>Share Capital:</label>
<input onBlur="this.value=formatCurrency(this.value)" type="hidden">
<input type="text" name="share" value="0" class="textbox"/>
<br>
<label>Term:</label>
<select name="terms"/>
<option value="1">1 Month</option>
<option value="2">2 Months</option>
</select>
<br />
<input type="submit" name="calculate" class="btn btn-success" value="Let's COMPUTE">
</form></td>
<td width="50%" align="justify" >
<div class="alert alert-info" align="justify" style="font-size:16px">
<?php if($data != false) { ?>
<table width="100%">
<tr>
<td width="40%" align="justify"><?php echo "Loan Receivable"; ?></td>
<td width="30%" align="right"><?php echo number_format($data['loan_receivable'], 2); ?></td>
<td width="30%" align="right"></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Interest "; ?></td>
<td width="30%" align="right"></td>
<td width="30%" align="right"><?php echo number_format($data['interest'], 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Service Fee "; ?></td>
<td width="30%" align="right"></td>
<td width="30%" align="right"><?php echo number_format($data['service_fee'], 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Filling Fee "; ?></td>
<td width="30%" align="right"></td>
<td width="30%" align="right"><?php echo number_format($data['filling_fee'], 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Cash On Hand "; ?></td>
<td width="30%" align="right"></td>
<td width="30%" align="right"><?php echo number_format($data['cash_on_hand'], 2); ?></td>
</tr>
<tr bgcolor="#CCCCCC" style="color:#000000; font-weight:bold">
<td width="40%" align="right"><?php echo "TOTAL "; ?></td>
<td width="30%" align="right"><?php echo number_format($data['debit'], 2); ?></td>
<td width="30%" align="right"><?php echo number_format($data['credit'], 2); ?></td>
</tr>
<tr>
<td><br/>
<br/></td>
<td><br/>
<br/></td>
<td><br/>
<br/></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Applied Loan "; ?></td>
<td width="30%" align="right"><?php echo number_format($data['share'], 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Term: "; ?></td>
<td width="30%" align="right"><?php echo $data['terms']. " month "; ?></td>
</tr>
</table>
<?php } ?>
</div>
</td>
</tr>
</table>
NOTE:Used previous link and have shortened the code.Please test it properly just did blank coding
<div class="span8" align="center">
<table width="100%">
<tr>
<td align="center" width="50%">
<form action="" method="POST">
<label> *NOTE: Php.36,000.00 - maximum applied loanable amount</label>
<br/>
<label>Share Capital:</label>
<input onBlur="this.value = formatCurrency(this.value)" type="hidden">
<input type="text" name="share" value="0" class="textbox"/><br>
<label>Term:</label>
<select name="terms"/>
<option value="1">1 Month</option>
<option value="2">2 Months</option>
</select> <br />
<input type="submit" name="calculate" class="btn btn-success" value="Let's COMPUTE">
</form></td>
<td width="50%" align="justify" >
<div class="alert alert-info" align="justify" style="font-size:16px">
<?php
if (isset($_POST['calculate'])) {
$share = $_POST['share'];
$terms = $_POST['terms'];
?>
<?php if ($share <= "30000") { ?>
<?php
if ($terms == "1") {
$interest = $share * .0130;
} elseif ($terms == "2") {
$interest = $share * .0195;
if ($terms == "1") {
$interest = $share * .0130;
} elseif ($terms == "2") {
$interest = $share * .0205;
}}
elseif ($share >= 30001) {
if ($terms == "1") {
$interest = $share * .0130;
} elseif ($terms == "2") {
$interest = $share * .0205;
}
}
?>
?>
<table width="100%">
<tr>
<td width="40%" align="justify"><?php echo "Loan Receivable"; ?></td>
<td width="30%" align="right"><?php echo number_format($loan_receivable, 2); ?> </td>
<td width="30%" align="right"> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Interest "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($interest, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Service Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($service_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Filling Fee "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($filling_fee, 2); ?></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Cash On Hand "; ?></td>
<td width="30%" align="right"> </td>
<td width="30%" align="right"><?php echo number_format($cash_on_hand, 2); ?></td>
</tr>
<tr bgcolor="#CCCCCC" style="color:#000000; font-weight:bold">
<td width="40%" align="right"><?php echo "TOTAL "; ?></td>
<td width="30%" align="right"><?php echo number_format($debit, 2); ?></td>
<td width="30%" align="right"><?php echo number_format($credit, 2); ?></td>
</tr>
<tr>
<td><br/><br/></td>
<td><br/><br/></td>
<td><br/><br/></td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Applied Loan "; ?></td>
<td width="30%" align="right"><?php echo number_format($share, 2); ?> </td>
</tr>
<tr>
<td width="40%" align="justify"><?php echo "Term: "; ?></td>
<td width="30%" align="right"><?php echo $terms . " month "; ?> </td>
</tr>
</table>
<?php } ?>
</div> </td>
</tr>
</table>
Related
i have a problem to create table like this image in website, can anyone help me to solve that?. blue line in picture. i just don't know how to create table like this image. especially reference no, it has custom border line.
Here is table design
you can check my code here too MY CODE
this is my code
<html xmlns="http://www.w3.org/1999/ifxhtml">
<head profile="http://www.w3.org/2005/10/profile">
<title>Glisten - A free web template</title>
</head>
<body>
<table width="800" border="1" align="center">
<tbody>
<tr>
<td colspan="2" align="center" bgcolor=""><table width="800" border="1" align="center">
<tbody>
<tr>
<td width="125">Reference No</td>
<td colspan="4"> </td>
<td colspan="2" bgcolor="#8B8A8A" align="center"></td>
</tr>
<tr>
<td align="center" bgcolor="#FF0004"><strong>NG TINEM</strong></td>
</tr>
<tr>
<td>Site ID</td>
<td colspan="3" align="center"></td>
<td width="185">BSC Name</td>
<td colspan="2" align="center"></td>
</tr>
<tr>
<td>Site Name</td>
<td colspan="3" align="center"></td>
<td>New Site ID</td>
<td colspan="2" align="center"></td>
</tr>
<tr>
<td>Sales Cluster</td>
<td colspan="3" align="center"></td>
<td>LAC</td>
<td colspan="2" align="center"></td>
</tr>
<tr>
<td>Ne Type</td>
<td colspan="3" align="center"></td>
<td>Config</td>
<td colspan="2" align="center"></td>
</tr>
<tr>
<td>Band</td>
<td colspan="3" align="center"></td>
<td>PO Number</td>
<td colspan="2" align="center"></td>
</tr>
<tr>
<td>Cell ID</td>
<td width="80" align="center"></td>
<td width="82" align="center"></td>
<td width="80" align="center"></td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="7" > </td>
</tr>
<tr>
<td align="center">Integration Date</td>
<td align="center"></td>
<td align="center">On Air Date</td>
<td align="center"></td>
<td align="center">Acceptance Date</td>
<td colspan="2" align="center"></td>
</tr>
<tr>
</tbody>
</table>
</body></html>
First identify the total columns to be created.
Then use attribute of table like "colspan" to span the columns.
Add following style to your table (I have added class table in your second table tag):
<style type="text/css">
.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th
{
padding: 8px;
line-height: 1.42857143;
vertical-align: top;
}
table {
border-collapse: collapse;
border-spacing: 0;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
}
</style>
<table width="800" align="center">
<tbody>
<tr>
<td colspan="2" align="center" bgcolor=""><table class="table" width="800" border="1" align="center">
<tbody>
<?php
while($data = mysql_fetch_array($query)){
if($data['dt_report']=='Yes'){
$check_dt_report='checked="checked"';
}
else{
$check_dt_report='';
}if($data['kpi_stats']=='Yes'){
$check_kpi_stats='checked="checked"';
}
else{
$check_kpi_stats='';
}
if($data['clear_alarm']=='Yes'){
$check_clear_alarm='checked="checked"';
}
else{
$check_clear_alarm='';
}
if($data['configuration']=='Yes'){
$check_configuration='checked="checked"';
}
else{
$check_configuration='';
}
if($data['neighbor']=='Yes'){
$check_neighbor='checked="checked"';
}
else{
$check_neighbor='';
}
?>
<tr>
<td width="125">Reference No</td>
<td colspan="4"> </td>
<td colspan="2" bgcolor="#8B8A8A" align="center"><?php echo $data['no_ref']; ?></td>
</tr>
<tr>
<td align="center" bgcolor="#FF0004"><strong>NG TINEM</strong></td>
</tr>
<tr>
<td>Site ID</td>
<td colspan="3" align="center"><?php echo $data['site_id']; ?></td>
<td width="185">BSC Name</td>
<td colspan="2" align="center"><?php echo $data['bsc_name']; ?></td>
</tr>
<tr>
<td>Site Name</td>
<td colspan="3" align="center"><?php echo $data['site_name']; ?></td>
<td>New Site ID</td>
<td colspan="2" align="center"><?php echo $data['new_site_id']; ?></td>
</tr>
<tr>
<td>Sales Cluster</td>
<td colspan="3" align="center"><?php echo $data['sales_cluster']; ?></td>
<td>LAC</td>
<td colspan="2" align="center"><?php echo $data['lac']; ?></td>
</tr>
<tr>
<td>Ne Type</td>
<td colspan="3" align="center"><?php echo $data['ne_type']; ?></td>
<td>Config</td>
<td colspan="2" align="center"><?php echo $data['config']; ?></td>
</tr>
<tr>
<td>Band</td>
<td colspan="3" align="center"><?php echo $data['band']; ?></td>
<td>PO Number</td>
<td colspan="2" align="center"><?php echo $data['po_number']; ?></td>
</tr>
<tr>
<td>Cell ID</td>
<td width="80" align="center"><?php echo $data['cell_id1']; ?></td>
<td width="82" align="center"><?php echo $data['cell_id2']; ?></td>
<td width="80" align="center"><?php echo $data['cell_id3']; ?></td>
<td> </td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="7" > </td>
</tr>
</tbody>
</table>
I have a page that image gets uploaded to but the image are not the right way.
I know I need to use EXIF but I am new to this and lost where to start on this as it is in a while loop
can any one help me
thx jason
here is my code
<section class ="box_1">
<form id="evaluations" method="post" action="comments_page_add.php" enctype="multipart/form-data">`enter code here`
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Parent Entered</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Lastname</strong></td>
</tr>
<?php
while($rows = mysqli_fetch_array($results2)){
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="child[]" type="checkbox" id="child[]" value="<?PHP echo $rows['id']; ?>"></td>
<td bgcolor="#FFFFFF"><?php echo $rows['given_name']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows['surname']; ?></td>
</tr>
<?php
}
?>
</table>
</section>
<section class ="box_3">
<?php
while($rows2 = mysqli_fetch_array($results3)){
?>
<table width="100%" border="2" bgcolor="#CCCCCC">
<tr>
<tr><td colspan="4" align="center"><img src='<?php echo $rows2['Photo_parth']; ?>' width='60%' height='150em'></td></tr>
<td align="center" bgcolor="#FFFFFF"><input name="image[]" type="checkbox" id="image[]" value="<?PHP echo $rows2['id']; ?>"></td>
<td bgcolor="#FFFFFF"><?php echo $rows2['id']; ?></td></tr>
<td bgcolor="#FFFFFF"><?php echo $rows2['date']; ?></td>
<td bgcolor="#FFFFFF"><?php echo $rows2['time']; ?></td>
</tr>
</table>
<?php
}
?>
</table>
</section>
I used php to generate rows of html table. Here is my code:
<?php $cols=mysql_num_rows($grds); ?>
<tr>
<td></td>
<?php do{ ?>
<td rowspan="<?php echo $cols; ?>" align="center">Internal<br />Grades</td>
<td colspan="2"> <?php echo strtoupper($row_grds['grade_name']);?></td>
<td align="center"><?php echo strtoupper($row_grds['igrade']);?></td>
</tr>
<?php } while ($row_grds=mysql_fetch_assoc($grds));?>
The html source generated by the above code is:
<tr>
<td></td>
<td rowspan="2" align="center">Internal<br />Grades</td>
<td colspan="2"> RHYMES</td>
<td align="center">B</td>
</tr>
<td rowspan="2" align="center">Internal<br />Grades</td>//I don't want this.
<td colspan="2"> CONVERSATION</td>
<td align="center">A</td>
</tr>
My expected output is:
<tr>
<td> </td>
<td rowspan="2"> Internal<br /> Grade</td>
<td colspan="2"> RHYMES</td>
<td align="center">B</td>
</tr>
<tr>
<td> </td>
<td colspan="2"> CONVERSATION</td>
<td align="center">A</td>
</tr>
<?php $i=0; while ($row_grds=mysql_fetch_assoc($grds)){ ?>
<tr>
<td></td>
<?php if($i==0): ?>
<td rowspan="<?php echo $cols; ?>" align="center">Internal<br />Grades</td>
<?php endif; ?>
<td colspan="2"> <?php echo strtoupper($row_grds['grade_name']);?></td>
<td align="center"><?php echo strtoupper($row_grds['igrade']);?></td>
</tr>
<?php $i++; } ?>
I have a database with 3 tables and 6 to 20 rows in each, but my PHP code creates 8 tables when there should be only 2 (2 post in the DB)
But why does it do that, I took the code from a different PHP page, where it works fine?
<?php
session_start();
require_once("connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Brand check</title>
</head>
<body>
<br />
<br />
<?php
$query = mysql_query("SELECT * FROM under_etage, sal_1, sal_2") or die(mysql_error());
while($row = mysql_fetch_array($query)) {
?>
<table width="1100" border="0" align="center" cellpadding="0" cellspacing="0"lass="bold_font">
<tr>
<td width="150" height="25" class="info"> <?php echo $row["etDate"]; ?></td>
<td width="100" height="25" class="info"> Lys</td>
<td width="100" height="25" class="info"> Skilt</td>
<td width="100" class="info" > Brandtæppe</td>
<td width="100" class="info"> Brand sprøjte</td>
<td width="500" class="info"> Døre</td>
</tr>
<tr>
<td height="20" class="split">Underetage</td>
<td width="50" class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
</tr>
<tr>
<td class="sort_bar">Opgang A</td>
<td width="50" height="25" class="info" ><?php echo $row["lys_u_a"]; ?></td>
<td class="info"><?php echo $row["skilt_u_a"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_a"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">Studie/gang</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_s"]; ?></td>
<td class="info"><?php echo $row["skilt_u_s"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_s"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">Opgang B</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_b"]; ?></td>
<td class="info"><?php echo $row["skilt_u_b"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_b"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">Bar - Festrum</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_bar"]; ?></td>
<td class="info"><?php echo $row["skilt_u_bar"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"> </td>
</tr>
<tr>
<td height="25" class="sort_bar">Opgang C</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_c"]; ?></td>
<td class="info"><?php echo $row["skilt_u_c"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_c"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">Opgang D</td>
<td width="50" height="25" class="info"><?php echo $row["lys_u_d"]; ?></td>
<td class="info"><?php echo $row["skilt_u_d"]; ?></td>
<td class="info"> </td>
<td class="info"> </td>
<td class="info"><?php echo $row["door_u_d"]; ?> </td>
</tr>
<tr>
<td height="20" class="split">Etager</td>
<td width="50" class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
</tr>
<tr>
<td class="grey_bar">1. Sal A</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1a"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_1a"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_1a"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_1a"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_1a"]; ?></td>
</tr>
<tr>
<td class="grey_bar">1. Sal B</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1b"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_1b"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_1b"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_1b"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_1b"]; ?></td>
</tr>
<tr>
<td class="grey_bar">1. Sal C</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1c"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_1c"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_1c"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_1c"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_1c"]; ?></td>
</tr>
<tr>
<td class="grey_bar">1. Sal D</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1d"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_1d"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_1d"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_1d"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_1d"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">2. Sal A</td>
<td width="50" height="25" class="info"><?php echo $row["lys_2a"]; ?></td>
<td class="info"><?php echo $row["skilt_2a"]; ?></td>
<td class="info"><?php echo $row["bt_2a"]; ?></td>
<td class="info"><?php echo $row["bs_2a"]; ?></td>
<td class="info"><?php echo $row["doors_2a"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">2. Sal B</td>
<td width="50" height="25" class="info"><?php echo $row["lys_2b"]; ?></td>
<td class="info"><?php echo $row["skilt_2b"]; ?></td>
<td class="info"><?php echo $row["bt_2b"]; ?></td>
<td class="info"><?php echo $row["bs_2b"]; ?></td>
<td class="info"><?php echo $row["doors_2b"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">2. Sal C</td>
<td width="50" height="25" class="info"><?php echo $row["lys_2c"]; ?></td>
<td class="info"><?php echo $row["skilt_2c"]; ?></td>
<td class="info"><?php echo $row["bt_2c"]; ?></td>
<td class="info"><?php echo $row["bs_2c"]; ?></td>
<td class="info"><?php echo $row["doors_2c"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">2. Sal D</td>
<td width="50" height="25" class="info"><?php echo $row["lys_2d"]; ?></td>
<td class="info"><?php echo $row["skilt_2d"]; ?></td>
<td class="info"><?php echo $row["bt_2d"]; ?></td>
<td class="info"><?php echo $row["bs_2d"]; ?></td>
<td class="info"><?php echo $row["doors_2d"]; ?></td>
</tr>
<tr>
<td class="grey_bar">3. Sal A</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3a"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_3a"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_3a"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_3a"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_3a"]; ?></td>
</tr>
<tr>
<td class="grey_bar">3. Sal B</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3b"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_3b"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_3b"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_3b"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_3b"]; ?></td>
</tr>
<tr>
<td class="grey_bar">3. Sal C</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3c"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_3c"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_3c"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_3c"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_3c"]; ?></td>
</tr>
<tr>
<td class="grey_bar">3. Sal D</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3d"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_3d"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_3d"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_3d"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_3d"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">4. Sal A</td>
<td width="50" height="25" class="info"><?php echo $row["lys_4a"]; ?></td>
<td class="info"><?php echo $row["skilt_4a"]; ?></td>
<td class="info"><?php echo $row["bt_4a"]; ?></td>
<td class="info"><?php echo $row["bs_4a"]; ?></td>
<td class="info"><?php echo $row["doors_4a"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">4. Sal B</td>
<td width="50" height="25" class="info"><?php echo $row["lys_4b"]; ?></td>
<td class="info"><?php echo $row["skilt_4b"]; ?></td>
<td class="info"><?php echo $row["bt_4b"]; ?></td>
<td class="info"><?php echo $row["bs_4b"]; ?></td>
<td class="info"><?php echo $row["doors_4b"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">4. Sal C</td>
<td width="50" height="25" class="info"><?php echo $row["lys_4c"]; ?></td>
<td class="info"><?php echo $row["skilt_4c"]; ?></td>
<td class="info"><?php echo $row["bt_4c"]; ?></td>
<td class="info"><?php echo $row["bs_4c"]; ?></td>
<td class="info"><?php echo $row["doors_4c"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">4. Sal D</td>
<td width="50" height="25" class="info"><?php echo $row["lys_4d"]; ?></td>
<td class="info"><?php echo $row["skilt_4d"]; ?></td>
<td class="info"><?php echo $row["bt_4d"]; ?></td>
<td class="info"><?php echo $row["bs_4d"]; ?></td>
<td class="info"><?php echo $row["doors_4d"]; ?> </td>
</tr>
<tr>
<td class="grey_bar">5. Sal A</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5a"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_5a"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_5a"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_5a"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_5a"]; ?></td>
</tr>
<tr>
<td class="grey_bar">5. Sal B</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5b"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_5b"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_5b"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_5b"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_5b"]; ?></td>
</tr>
<tr>
<td class="grey_bar">5. Sal C</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5c"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_5c"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_5c"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_5c"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_5c"]; ?></td>
</tr>
<tr>
<td class="grey_bar">5. Sal D</td>
<td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5d"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_5d"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_5d"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_5d"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_5d"]; ?></td>
</tr>
<tr>
<td height="25" class="sort_bar">6. Sal A</td>
<td width="50" height="25" class="info"><?php echo $row["lys_6a"]; ?></td>
<td class="info"><?php echo $row["skilt_6a"]; ?></td>
<td class="info"><?php echo $row["bt_6a"]; ?></td>
<td class="info"><?php echo $row["bs_6a"]; ?></td>
<td class="info"><?php echo $row["doors_6a"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">6. Sal B</td>
<td width="50" height="25" class="info"><?php echo $row["lys_6b"]; ?></td>
<td class="info"><?php echo $row["skilt_6b"]; ?></td>
<td class="info"><?php echo $row["bt_6b"]; ?></td>
<td class="info"><?php echo $row["bs_6b"]; ?></td>
<td class="info"><?php echo $row["doors_6b"]; ?> </td>
</tr>
<tr>
<td height="25" class="sort_bar">6. Sal C</td>
<td width="50" height="25" class="info"><?php echo $row["lys_6c"]; ?></td>
<td class="info"><?php echo $row["skilt_6c"]; ?></td>
<td class="info"><?php echo $row["bt_6c"]; ?></td>
<td class="info"><?php echo $row["bs_6c"]; ?></td>
<td class="info"><?php echo $row["doors_6c"]; ?> </td>
</tr >
<tr>
<td height="25" class="sort_bar">6. Sal D</td>
<td width="50" height="25" class="info"><?php echo $row["lys_6d"]; ?></td>
<td class="info"><?php echo $row["skilt_6d"]; ?></td>
<td class="info"><?php echo $row["bt_6d"]; ?></td>
<td class="info"><?php echo $row["bs_6d"]; ?></td>
<td class="info"><?php echo $row["doors_6d"]; ?> </td>
</tr>
<tr>
<td height="25" class="grey_bar">7. Sal A</td>
<td width="50" height="25" class="grey_bar"><?php echo $row["lys_7a"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_7a"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_7a"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_7a"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_7a"]; ?> </td>
</tr>
<tr>
<td height="25" class="grey_bar">7. Sal B</td>
<td width="50" height="25" class="grey_bar"><?php echo $row["lys_7b"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_7b"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_7b"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_7b"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_7b"]; ?> </td>
</tr>
<tr>
<td height="25" class="grey_bar">7. Sal C</td>
<td width="50" height="25" class="grey_bar"><?php echo $row["lys_7c"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_7c"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_7c"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_7c"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_7c"]; ?> </td>
</tr>
<tr>
<td height="25" class="grey_bar">7. Sal D</td>
<td width="50" height="25" class="grey_bar"><?php echo $row["lys_7d"]; ?></td>
<td class="grey_bar"><?php echo $row["skilt_7d"]; ?></td>
<td class="grey_bar"><?php echo $row["bt_7d"]; ?></td>
<td class="grey_bar"><?php echo $row["bs_7d"]; ?></td>
<td class="grey_bar"><?php echo $row["doors_7d"]; ?> </td>
</tr>
<tr>
<td height="20" class="split">Taget</td>
<td width="50" class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
<td class="split"> </td>
</tr>
<tr>
<td height="14" class="sort_bar">Taget</td>
<td width="50" height="25" class="info" ><?php echo $row["lys_t"]; ?></td>
<td class="info"><?php echo $row["skilt_t"]; ?></td>
<td class="info"></td>
<td class="info"><?php echo $row["brand_s_t"]; ?></td>
<td class="info"><?php echo $row["door_t"]; ?></td>
</tr>
</table>
<br />
<?php } ?>
</body>
</html>
Follow this example and use your data trust me it will work
// set up your query within a variable to make it easier to work with
$query = "SELECT * FROM people";
$result = mysql_query($query); //this will conect to the database and select the table to run the query on and return the values from that table.
// now we will set up a while loop to retrieve the information from the database table.
while ($person = mysql_fetch_array($result)) {
echo "<h3>". $person['name'] ."</h3>"; // this line will fetch the query result that is stored in the $person variable and find the row ['name'] and display it on screen
echo "<p>". $person['info'] ."</p>";
}
?>
what if you broke the query into sections so the first query selected * from the one table and the next query selected data the other table then pass both variables thru the mysql_fetch_array($query1, $query2)
Am currently developing a web application which does the process of invoice etc.
Customer is using dot matrix printer to print invoice sheet. They said the requirement in printing as if there is more than 5 items in a sheet the rest should come as next sheet.
I have made that using PHP but i don't know how to print the next sheet in next page. It just prints as usual in sequence which results in a sheet printed in 2 pages. Any help or ideas will be appreciated. Below is the code how i generated sheet.
Thanks
<script type="text/javascript">
function printPage(){
var divElements = document.getElementById('printDataHolder').innerHTML;
var oldPage = document.body.innerHTML;
document.body.innerHTML="<link rel='stylesheet' href='css/common.css' type='text/css' /><body class='bodytext'>"+divElements+"</body>";
window.print();
document.body.innerHTML = oldPage;
}
</script>
<?php
$limit=5;
$cnt=0; // for table header and footer
$cnt2=1;// for no of rows count to print total values in end
$total=0;
?>
<div id="contentHolder" align="center">
<input type="button" value="Print" class="btnclass" onclick="printPage()" /> <input type="button" class="btnclass" value="Click to Proceed" style="width:100px;" onclick="Javascript:window.location.href='invoice.php';" />
<br />
<div id="printDataHolder">
<?php while($data=mysql_fetch_array($invcontents)){ ?>
<?php if($cnt==0){ ?>
<table width="800" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #4E9A91;">
<tr>
<td height="29" colspan="4" style="font-size:22px; padding-left:10px;"><strong>OvalTechnologies</strong></td>
</tr>
<tr>
<td colspan="4" style="padding-left:10px;"><?php echo($branchdetails['address']); ?></td>
</tr>
<tr>
<td height="19" colspan="4" style="padding-left:10px;">Website : www.ovaltechnologies.in Phone No : <?php echo($branchdetails['phoneno']); ?></td>
</tr>
<tr>
<td height="12" colspan="4" style="border-bottom:1px solid #4E9A91;"> </td>
</tr>
<tr>
<td height="28" colspan="3" style="padding-left:10px;">Customer Name : <?php echo($invtotal['customername']); ?></td>
<td width="226"> </td>
</tr>
<tr>
<td width="309" height="28" style="padding-left:10px;border-bottom:1px solid #4E9A91;">Invoice No : <?php echo($invoiceid); ?></td>
<td colspan="2" style="border-bottom:1px solid #4E9A91;">Paid As : <?php echo($invtotal['paidas']); ?></td>
<td style="border-bottom:1px solid #4E9A91;">Date : <?php echo(getonlydatefromdatetime(changefromdbdate($invtotal['invoicedate']))); ?></td>
</tr>
<tr>
<td height="28" class="rowborder" style="padding-left:10px;"><strong>Item Name</strong></td>
<td width="136" class="rowborder"><strong>Rate</strong></td>
<td width="129" class="rowborder"><strong>Qty</strong></td>
<td class="rowborder"><strong>Amount</strong></td>
</tr>
<?php } ?>
<tr>
<td align="center" height="28" style="padding-left:10px;"><?php echo($data['item']); ?> : <?php echo($data['brand']." "); ?><?php echo($data['type']); ?></td>
<td align="center"><?php echo($data['billedamount']); ?></td>
<td align="center"><?php echo($data['quantity']); ?></td>
<td align="center"><?php echo($data['billedamount']*$data['quantity']); ?></td>
</tr>
<?php
if($cnt2==$invcount){//printing emptylines to fill up page
for($i=$cnt+1;$i<$limit;$i++){
?>
<tr>
<td height="28" style="padding-left:10px;"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php
}
}//printing emptylines to fill page ends
?>
<?php if($cnt==$limit-1 || $cnt2==$invcount){ ?>
<?php if($invtotal['transport']!="") {?>
<tr>
<td style="padding-left:10px; border-top:1px solid #4E9A91;" class="rowborder" height="28">Transport : <?php echo($invtotal['transport']); ?></td>
<td class="rowborder" style="border-top:1px solid #4E9A91;">Transport Cost : <?php echo($invtotal['transportcost']); ?></td>
<td class="rowborder" style="border-top:1px solid #4E9A91;">Destination : <?php echo($invtotal['destination']); ?></td>
<td class="rowborder" style="border-top:1px solid #4E9A91;"> </td>
</tr>
<?php } ?>
<tr>
<td height="28" class="rowborder" style="border-top:1px solid #4E9A91;"> </td>
<td class="rowborder" style="border-top:1px solid #4E9A91;"><?php if($invtotal['transport']!="") {if($invtotal['addtransport']=="no"){echo("Transport Cost Not Added");}}?></td>
<td class="rowborder" style="border-top:1px solid #4E9A91;">Total</td>
<td class="rowborder" style="border-top:1px solid #4E9A91;"><?php echo($invtotal['totalamount']);?></td>
</tr>
<tr>
<td height="28"> </td>
<td> </td>
<td> </td>
<td align="center">Invoice Done By</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table><br />
<?php } ?>
<?php
$cnt++;
$cnt2++;
if($cnt==$limit){
$cnt=0;
}
} ?>
</div>
</div>
<?php
} ?>
do not see such options in http://www.php.net/manual/en/function.printer-set-option.php
but you can have look around the functions here http://www.php.net/manual/en/ref.printer.php
printer_start_doc — Start a new document
printer_start_page — Start a new page