Jump to content

Recommended Posts

A ex employee of ours set up an web form that allows us to input certain data which then produces a word document with the fields entered in the form added to the document template.  We have used this for a while with great success, until now.  When certain fields are entered with numeric values the documents are created correctly.  However, now some of these fields require alpha-numeric characters.  This has stopped the documents being created.  The mysql database fields that require alpha numeric characters are set to VarChar.  But I do not know what could be causing the issue?

 

Any help would be greatly appriciated as I am unable to get hold of the ex employee who created it!

 

 

Link to comment
https://forums.phpfreaks.com/topic/298342-help-please/
Share on other sites

Is the script that processes the form submission set to detect whether the fields are numeric? Perhaps the script only generates a Word document when all the form fields pass the required validation steps. Are you able to post the code which process the form submission?

Link to comment
https://forums.phpfreaks.com/topic/298342-help-please/#findComment-1521695
Share on other sites

Thanks for the replies.  I have no idea what you are asking but here is the script.

 

 

<?php
 
 
require_once 'lib/PHPRtfLite.php';
PHPRtfLite::registerAutoloader();
 
/*CODE FOR EXTRACTING DATA FROM DATABASE*/
include('config.php');
extract($_GET);
$result = mysql_query("SELECT * FROM custom_doc WHERE invoice = '$invoice' ORDER BY inv_date DESC ");
$row = mysql_fetch_object($result);
 
if($row->container_number_1 != "")
$container[] = $row->container_number_1;
if($row->container_number_2 != "")
$container[] = $row->container_number_2;
if($row->container_number_3 != "")
$container[] = $row->container_number_3;
if($row->container_number_4 != "")
$container[] = $row->container_number_4;
if($row->container_number_5 != "")
$container[] = $row->container_number_5;
if($row->container_number_6 != "")
$container[] = $row->container_number_6;
if($row->container_number_7 != "")
$container[] = $row->container_number_7;
if($row->container_number_8 != "")
$container[] = $row->container_number_8;
if($row->container_number_9 != "")
$container[] = $row->container_number_9;
if($row->container_number_10 != "")
$container[] = $row->container_number_10;
if($row->container_number_11 != "")
$container[] = $row->container_number_11;
if($row->container_number_12 != "")
$container[] = $row->container_number_12;
if($row->container_number_13 != "")
$container[] = $row->container_number_13;
if($row->container_number_14 != "")
$container[] = $row->container_number_14;
if($row->container_number_15 != "")
$container[] = $row->container_number_15;
 
//$container_number = implode(',',$container);
if(count($container)>1) 
$container_number = implode(',',$container);
else if (count($container) == 1)
$container_number = $container[0];
else
$container_number = '';
 
$total_container_number = count($container);
 
if($row->seal_number_1 != "")
$seal[] = $row->seal_number_1;
if($row->seal_number_2 != "")
$seal[] = $row->seal_number_2;
if($row->seal_number_3 != "")
$seal[] = $row->seal_number_3;
if($row->seal_number_4 != "")
$seal[] = $row->seal_number_4;
if($row->seal_number_5 != "")
$seal[] = $row->seal_number_5;
if($row->seal_number_6 != "")
$seal[] = $row->seal_number_6;
if($row->seal_number_7 != "")
$seal[] = $row->seal_number_7;
if($row->seal_number_8 != "")
$seal[] = $row->seal_number_8;
if($row->seal_number_9 != "")
$seal[] = $row->seal_number_9;
if($row->seal_number_10 != "")
$seal[] = $row->seal_number_10;
if($row->seal_number_11 != "")
$seal[] = $row->seal_number_11;
if($row->seal_number_12 != "")
$seal[] = $row->seal_number_12;
if($row->seal_number_13 != "")
$seal[] = $row->seal_number_13;
if($row->seal_number_14 != "")
$seal[] = $row->seal_number_14;
if($row->seal_number_15 != "")
$seal[] = $row->seal_number_15;
 
if(count($seal)>1) 
$seal_number = implode(',',$seal);
else if (count($seal) == 1)
$seal_number = $seal[0];
else
$seal_number = '';
/*** Variables used in the following document ***/
 
$rtf = new PHPRtfLite();
 
// Set margins
$rtf->setMarginLeft(1.5);
$rtf->setMarginRight(1.5);
$rtf->setMarginTop(1.7564);
$rtf->setMarginBottom(1.27);
 
 
if($row->bl_number > 0)
{
//#################################################
/*START OF CERTIFICATE OF ANALYSIS PAGE FROM HERE*/
 
$section = $rtf->addSection();
 
// This is the standard font.
$font = new PHPRtfLite_Font(24,'Arial Black');
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
// Spaces after paragraph
$parFormat->setSpaceAfter(1);
$parFormat->setSpaceBefore(1);
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$header = $section->addHeader();
$header->writeText('Carbora Environmental', $font, $parFormat);
 
$font = new PHPRtfLite_Font(22,'Calibri (Body)');
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
 
$section->writeText('<br><br><br><br>CERTIFICATE OF ANALYSIS<br><br>', $font, $parFormat);
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(12,'Calibri (Body)');
$section->writeText(' '.date('d/m/Y').'<br><br>', $font, $parFormat);
$section->writeText('We are forwarding you the material analysis certificate certifying to the following test in values taken on average basis.<br>', $font, $parFormat);
 
$section->writeText('Container :'.$container_number.'<br>', $font, $parFormat);
$section->writeText('Seal :'.$seal_number.'<br>', $font, $parFormat);
$section->writeText("Invoice No : $invoice".'<br>', $font, $parFormat);
$section->writeText("Dated : ".date('y-m-d',strtotime($row->inv_date))."<br>", $font, $parFormat);
 
$section->writeText('Total Quantity: 26.5 tonnes'.'<br><br><br>', $font, $parFormat);
 
$section->writeText('RUBBER CONTENT : 50%'.'<br>', $font, $parFormat);
$section->writeText('CARBON CONTENT : 24%'.'<br>', $font, $parFormat);
$section->writeText('ACETONE CONTENT : 11%'.'<br>', $font, $parFormat);
$section->writeText('ASH CONTENT : 04%'.'<br>', $font, $parFormat);
$section->writeText(' STEEL WIRE : 11%'.'<br>', $font, $parFormat);
 
//#############################################
/*STARTING OF FOOTER SECTION OF THE DOCUMENT*/
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(8,'Calibri (Body)');
$footer = $section->addFooter();
 
$imageFile = 'stamp.png';
 
$table = $footer->addTable();
$table->addRows(1);
$table->addColumnsList(array(5, 8, 6));
// add image to table in header
$table->writeToCell(1, 1, 'Carbora Environmental Limited<br>72 North Road<br>Richmond<br>TW9 4HQ<br>England', $font, $parFormat);
$table->writeToCell(1, 2, 'enquiries@carboraenvironmental.com<br>www.carboraenvironmental.com<br><br><br>Registered in England     Company No 9321437', $font, $parFormat);
$image = $table->addImageToCell(1, 3, $imageFile);
}
 
 
if($row->bl_number > 0)
{ 
//#################################################
/*START OF CERTIFICATE OF ORIGIN PAGE FROM HERE*/
$section = $rtf->addSection();
 
// This is the standard font.
$font = new PHPRtfLite_Font(24,'Arial Black');
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
// Spaces after paragraph
$parFormat->setSpaceAfter(1);
$parFormat->setSpaceBefore(1);
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$header = $section->addHeader();
$header->writeText('Carbora Environmental', $font, $parFormat);
 
$font = new PHPRtfLite_Font(22,'Calibri (Body)');
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
 
$section->writeText('<br><br><br><br>Certificate of Origin<br><br><br><br>', $font, $parFormat);
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(12,'Calibri (Body)');
$section->writeText(' Date :'.date('d/m/Y').'', $font, $parFormat);
$section->writeText(' Invoice No :'.$invoice.'<br><br>', $font, $parFormat);
$section->writeText("This is to certify that the Tyres Scrap (Cut in 2 &3 pcs arises from used & old tyres) shipped on the $row->vessel_name sailed from $row->port_name by Carbora Environmental Limited on ".date('y-m-d',strtotime($row->sail_date))." are cut into 3PCs in UK, after they become scrap.<br><br>", $font, $parFormat);
$section->writeText('For Carbora Environmental limited<br><br>', $font, $parFormat);
 
$font = new PHPRtfLite_Font(26,'Freestyle Script');
$section->writeText('Paul Gunn<br><br>', $font, $parFormat);
 
$font = new PHPRtfLite_Font(12,'Calibri (Body)');
$section->writeText('Authorised Signatory', $font, $parFormat);
 
 
//#############################################
/*STARTING OF FOOTER SECTION OF THE DOCUMENT*/
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(8,'Calibri (Body)');
$footer = $section->addFooter();
 
$imageFile = 'stamp.png';
 
$table = $footer->addTable();
$table->addRows(1);
$table->addColumnsList(array(5, 8, 6));
// add image to table in header
$table->writeToCell(1, 1, 'Carbora Environmental Limited<br>72 North Road<br>Richmond<br>TW9 4HQ<br>England', $font, $parFormat);
$table->writeToCell(1, 2, 'enquiries@carboraenvironmental.com<br>www.carboraenvironmental.com<br><br><br>Registered in England     Company No 9321437', $font, $parFormat);
$image = $table->addImageToCell(1, 3, $imageFile);
 
}
//#################################################
/*START OF INVOICE PAGE FROM HERE*/
$section = $rtf->addSection();
 
// This is the standard font.
$font = new PHPRtfLite_Font(24,'Arial Black');
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
// Spaces after paragraph
$parFormat->setSpaceAfter(1);
$parFormat->setSpaceBefore(1);
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$header = $section->addHeader();
$header->writeText('Carbora Environmental', $font, $parFormat);
 
$font = new PHPRtfLite_Font(22,'Calibri (Body)');
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
 
$section->writeText('<br><br><br><br>COMMERCIAL INVOICE<br><br>', $font, $parFormat);
 
$parFormat_center = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(10,'Calibri (Body)');
$section->writeText(' <b>Dated'.date('d/m/Y').'</b>', $font, $parFormat);
$section->writeText(' <b>Inv. No .'.$invoice.'</b>', $font, $parFormat);
$section->writeText('<b></b>', $font, $parFormat);
$section->writeText('<b>Importer:-Tinna Rubber & Infrastructure Limited,</b>', $font, $parFormat);
$section->writeText('<b>Gut No. 113/2 & 114/2, Village Pali, Jawahar Road,</b>', $font, $parFormat);
$section->writeText('<b>Taluka Wada, Distt. Thane, Maharashtra-431 303, India</b><br>', $font, $parFormat); 
$section->writeText('<b>Shipper:- Carbora Environmental Limited, UK</b><br>', $font, $parFormat); 
 
$section->writeText("<b>B/L  No $row->bl_number</b><br>", $font, $parFormat);
$section->writeText("<b>Total Container:$total_container_number"."x40 HC.</b> $container_number<br>", $font, $parFormat); 
 
$table = $section->addTable();
 
// Table border formating
$border = new PHPRtfLite_Border(
$rtf,
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000')
);
 
 
 
$table->addRows(3, 0.5);
$table->addColumnsList(array(6,3,2,3,3));
$table->setBorderForCellRange($border, 1, 1, 3, 5);
$table->mergeCellRange(3, 1, 3, 4);
 
 
$table->writeToCell(1, 1, '<b>Descriptions</b>', $font, $parFormat);
$table->writeToCell(1, 2, '<b>Origin Of Merchandize</b>', $font, $parFormat);
$table->writeToCell(1, 3, '<b>No. of Containers</b>', $font, $parFormat); 
$table->writeToCell(1, 4, '<b>Unit Price</b>', $font, $parFormat);
$table->writeToCell(1, 5, '<b>Amount USD</b>', $font, $parFormat);
 
 
$table->writeToCell(2, 1, '<b>Tyres Scrap cut in 2 &3<br>pcs(Arises from used & old<br>tyres),</b>', $font, $parFormat);
$table->writeToCell(2, 2, '<b>United <br>Kingdom</b>', $font, $parFormat_center);
$table->writeToCell(2, 3, '<b></b>', $font, $parFormat_center); 
$table->writeToCell(2, 4, '<b></b>', $font, $parFormat_center);
$table->writeToCell(2, 5, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(3, 1, '<b>Net Payable Amount</b>', $font, $parFormat_center);
$table->writeToCell(3, 5, '<b></b>', $font, $parFormat_center);
 
$section->writeText('<br><br><br><b>Total Amount in USD </b><br>', $font, $parFormat); 
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(8,'Calibri (Body)');
$footer = $section->addFooter();
 
$imageFile = 'stamp.png';
 
$table = $footer->addTable();
$table->addRows(1);
$table->addColumnsList(array(5, 8, 6));
// add image to table in header
$table->writeToCell(1, 1, 'Carbora Environmental Limited<br>72 North Road<br>Richmond<br>TW9 4HQ<br>England', $font, $parFormat);
$table->writeToCell(1, 2, 'enquiries@carboraenvironmental.com<br>www.carboraenvironmental.com<br><br><br>Registered in England     Company No 9321437', $font, $parFormat);
$image = $table->addImageToCell(1, 3, $imageFile);
 
//#################################################
/*START OF PACKING LIST PAGE FROM HERE*/
$section = $rtf->addSection();
 
// This is the standard font.
$font = new PHPRtfLite_Font(22,'Arial Black');
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
// Spaces after paragraph
$parFormat->setSpaceAfter(1);
$parFormat->setSpaceBefore(1);
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$header = $section->addHeader();
$header->writeText('<b>Carbora Environmental</b>', $font, $parFormat);
 
$font = new PHPRtfLite_Font(22,'Calibri (Body)');
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
 
$section->writeText('<br><b>Packing List</b><br>', $font, $parFormat);
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(10,'Calibri (Body)');
$section->writeText(' <b>PL No .'.$row->pl_number.'</b>', $font, $parFormat);
$section->writeText(' <b>Date :'.date('d/m/Y').'</b>', $font, $parFormat);
$section->writeText('<b></b>', $font, $parFormat);
$section->writeText('<b>Importer:-Tinna Rubber & Infrastructure Limited,</b>', $font, $parFormat);
$section->writeText('<b>Gut No. 113/2 & 114/2, Village Pali, Jawahar Road,</b>', $font, $parFormat);
$section->writeText('<b>Taluka Wada, Distt. Thane, Maharashtra-431 303, India</b><br>', $font, $parFormat); 
$section->writeText('<b>Shipper:- Carbora Environmental Limited, UK</b><br>', $font, $parFormat); 
 
$parFormat_center = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(8,'Calibri (Body)');
$section->writeText("<b>BL No :- $row->bl_number</b><br>", $font, $parFormat);
$section->writeText("<b>Vessel Name : $row->vessel_name</b><br>", $font, $parFormat);
$section->writeText('<b>Description of Goods: Tyres Scrap cut in 2 &3 pcs (Arises from used & old tyres)</b><br>', $font, $parFormat);
$section->writeText('<b> Ex-Yard, UK</b><br>', $font, $parFormat); 
 
$section->writeText("<b>Invoice No : $invoice</b><br>", $font, $parFormat);
$section->writeText('<b>Country of Origin: United Kingdom</b><br>', $font, $parFormat); 
$section->writeText("<b>Packing Type:  Loose Packing in $total_container_number"."x40 HC Container</b><br>", $font, $parFormat); 
 
 
$table = $section->addTable();
 
// Table border formating
$border = new PHPRtfLite_Border(
$rtf,
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000')
);
 
 
$table->addRows(16, 0.5);
$table->addColumnsList(array(4,4,4,4));
$table->setBorderForCellRange($border, 1, 1, 16, 4);
 
$table->writeToCell(1, 1, '<b>Sr. No.</b>', $font, $parFormat);
$table->writeToCell(1, 2, '<b>Container No.</b>', $font, $parFormat);
$table->writeToCell(1, 3, '<b>Container Seal No</b>', $font, $parFormat);
$table->writeToCell(1, 4, '<b>Cargo G.W M/Tons</b>', $font, $parFormat);
 
$table->writeToCell(2, 1, '<b>1.</b>', $font, $parFormat);
$table->writeToCell(2, 2, "<b>$row->container_number_1</b>", $font, $parFormat_center);
$table->writeToCell(2, 3, "<b>$row->seal_number_1</b>", $font, $parFormat_center);
$table->writeToCell(2, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(3, 1, '<b>2.</b>', $font, $parFormat);
$table->writeToCell(3, 2, "<b>$row->container_number_2</b>", $font, $parFormat_center);
$table->writeToCell(3, 3, "<b>$row->seal_number_2</b>", $font, $parFormat_center);
$table->writeToCell(3, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(4, 1, '<b>3.</b>', $font, $parFormat);
$table->writeToCell(4, 2, "<b>$row->container_number_3</b>", $font, $parFormat_center);
$table->writeToCell(4, 3, "<b>$row->seal_number_3</b>", $font, $parFormat_center);
$table->writeToCell(4, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(5, 1, '<b>4.</b>', $font, $parFormat);
$table->writeToCell(5, 2, "<b>$row->container_number_4</b>", $font, $parFormat_center);
$table->writeToCell(5, 3, "<b>$row->seal_number_4</b>", $font, $parFormat_center);
$table->writeToCell(5, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(6, 1, '<b>5.</b>', $font, $parFormat);
$table->writeToCell(6, 2, "<b>$row->container_number_5</b>", $font, $parFormat_center);
$table->writeToCell(6, 3, "<b>$row->seal_number_5</b>", $font, $parFormat_center);
$table->writeToCell(6, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(7, 1, '<b>6.</b>', $font, $parFormat);
$table->writeToCell(7, 2, "<b>$row->container_number_6</b>", $font, $parFormat_center);
$table->writeToCell(7, 3, "<b>$row->seal_number_6</b>", $font, $parFormat_center);
$table->writeToCell(7, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(8, 1, '<b>7.</b>', $font, $parFormat);
$table->writeToCell(8, 2, "<b>$row->container_number_7</b>", $font, $parFormat_center);
$table->writeToCell(8, 3, "<b>$row->seal_number_7</b>", $font, $parFormat_center);
$table->writeToCell(8, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(9, 1, '<b>8.</b>', $font, $parFormat);
$table->writeToCell(9, 2, "<b>$row->container_number_8</b>", $font, $parFormat_center);
$table->writeToCell(9, 3, "<b>$row->seal_number_8</b>", $font, $parFormat_center);
$table->writeToCell(9, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(10, 1, '<b>9.</b>', $font, $parFormat);
$table->writeToCell(10, 2, "<b>$row->container_number_9</b>", $font, $parFormat_center);
$table->writeToCell(10, 3, "<b>$row->seal_number_9</b>", $font, $parFormat_center);
$table->writeToCell(10, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(11, 1, '<b>10.</b>', $font, $parFormat);
$table->writeToCell(11, 2, "<b>$row->container_number_10</b>", $font, $parFormat_center);
$table->writeToCell(11, 3, "<b>$row->seal_number_10</b>", $font, $parFormat_center);
$table->writeToCell(11, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(12, 1, '<b>11.</b>', $font, $parFormat);
$table->writeToCell(12, 2, "<b>$row->container_number_11</b>", $font, $parFormat_center);
$table->writeToCell(12, 3, "<b>$row->seal_number_11</b>", $font, $parFormat_center);
$table->writeToCell(12, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(13, 1, '<b>12.</b>', $font, $parFormat);
$table->writeToCell(13, 2, "<b>$row->container_number_12</b>", $font, $parFormat_center);
$table->writeToCell(13, 3, "<b>$row->seal_number_12</b>", $font, $parFormat_center);
$table->writeToCell(13, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(14, 1, '<b>13.</b>', $font, $parFormat);
$table->writeToCell(14, 2, "<b>$row->container_number_13</b>", $font, $parFormat_center);
$table->writeToCell(14, 3, "<b>$row->seal_number_13</b>", $font, $parFormat_center);
$table->writeToCell(14, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(15, 1, '<b>14.</b>', $font, $parFormat);
$table->writeToCell(15, 2, "<b>$row->container_number_14</b>", $font, $parFormat_center);
$table->writeToCell(15, 3, "<b>$row->seal_number_14</b>", $font, $parFormat_center);
$table->writeToCell(15, 4, '<b></b>', $font, $parFormat_center);
 
$table->writeToCell(16, 1, '<b>15.</b>', $font, $parFormat);
$table->writeToCell(16, 2, "<b>$row->container_number_15</b>", $font, $parFormat_center);
$table->writeToCell(16, 3, "<b>$row->seal_number_15</b>", $font, $parFormat_center);
$table->writeToCell(16, 4, '<b></b>', $font, $parFormat_center);
 
$section->writeText('<br><b>Total Weight  Mt.</b>', $font, $parFormat); 
 
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(8,'Calibri (Body)');
$footer = $section->addFooter();
 
$imageFile = 'stamp.png';
 
$table = $footer->addTable();
$table->addRows(1);
$table->addColumnsList(array(5, 8, 6));
// add image to table in header
$table->writeToCell(1, 1, 'Carbora Environmental Limited<br>72 North Road<br>Richmond<br>TW9 4HQ<br>England', $font, $parFormat);
$table->writeToCell(1, 2, 'enquiries@carboraenvironmental.com<br>www.carboraenvironmental.com<br><br><br>Registered in England     Company No 9321437', $font, $parFormat);
$image = $table->addImageToCell(1, 3, $imageFile);
 
 
if($row->bl_number > 0)
{
//#################################################
/*START OF PACKING LIST PAGE FROM HERE*/
$section = $rtf->addSection();
 
// This is the standard font.
$font = new PHPRtfLite_Font(24,'Arial Black');
 
$parFormat_center = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER);
// Spaces after paragraph
$parFormat->setSpaceAfter(1);
$parFormat->setSpaceBefore(1);
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$header = $section->addHeader();
$header->writeText('Carbora Environmental', $font, $parFormat);
 
$font = new PHPRtfLite_Font(9,'Arial (Body CS)');
$parFormat_l = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
 
$section->writeText('<br><br><b><u>FORM-9</u></b>', $font, $parFormat_center);
$section->writeText('<hr>', $font, $parFormat_center);
$section->writeText('<b><u>[SEE RULES 15(5) AND 16(5), 16(6)1
TRANSBOUNDARY MOVEMENT-MOVEMENT DOCUMENT
</u></b><br><br>', $font, $parFormat_center);
 
$table = $section->addTable();
 
// Table border formating
$border = new PHPRtfLite_Border(
$rtf,
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000'),
new PHPRtfLite_Border_Format(1, '#000000')
);
 
 
$table->addRows(39, 0.5);
$table->addColumnsList(array(2,10,6));
$table->setBorderForCellRange($border, 1, 1, 39, 3);
$table->mergeCellRange(1, 3, 2, 3);
 
$table->mergeCellRange(2, 1, 7, 1);
$table->mergeCellRange(8, 1, 9, 1);
$table->mergeCellRange(17, 1, 23, 1);
$table->mergeCellRange(25, 1, 26, 1);
$table->mergeCellRange(27, 1, 32, 1);
 
 
$table->writeToCell(1, 1, '<b>SR NO</b>', $font, $parFormat);
$table->writeToCell(1, 2, '<b>DESCRIPTION</b>', $font, $parFormat_l);
$table->writeToCell(1, 3, '<b>DETAILS TO BE FURNISHED BY THE
EXPORTER IMPORTER
Carbora Environmental Limited
72 North Road, Richmond, TW9 4HQ, England</b>', $font, $parFormat_l);
 
$table->writeToCell(2, 1, '<b>1.</b>', $font, $parFormat);
$table->writeToCell(2, 2, '<b>(1) EXPORTER (NAME AND ADDRESS)</b>', $font, $parFormat_l);
$table->writeToCell(2, 3, '<b>Carbora Environmental Limited
72 North Road, Richmond, TW9 4HQ, England                                       
</b>', $font, $parFormat_l);
 
$table->writeToCell(3, 2, '<b>CONTACT PERSON</b>', $font, $parFormat);
$table->writeToCell(3, 3, '<b>Mr. Paul Gunn</b>', $font, $parFormat);
 
$table->writeToCell(4, 2, '<b>TEL,FAX</b>', $font, $parFormat);
$table->writeToCell(4, 3, '<b>+007711 183969</b>', $font, $parFormat);
 
$table->writeToCell(5, 2, '<b>(II) WASTE GENERATOR /EXPORTER FOR ** CATEGORY
(NAME AND ADDRESS):
</b>', $font, $parFormat);
$table->writeToCell(5, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(6, 2, '<b>CONTACT PERSON WITH TEL./FAX</b>', $font, $parFormat);
$table->writeToCell(6, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(7, 2, '<b>SITE OF GENERATION (EXCLUDED FOR ** CATEGORY)</b>', $font, $parFormat);
$table->writeToCell(7, 3, '<b>-</b>', $font, $parFormat);
 
 
$table->writeToCell(8, 1, '<b>2.</b>', $font, $parFormat);
$table->writeToCell(8, 2, '<b>IMPORTER /RECYCLER(NAME & ADDRESS)</b>', $font, $parFormat);
$table->writeToCell(8, 3, '<b>Tinna Rubber & Infrastructure Limited, 
Gut No. 113/2 & 114/2, Village Pali, Jawahar Road, Taluka Wada,  Distt. Thane, Maharashtra-431 303, India
</b>', $font, $parFormat);
 
$table->writeToCell(9, 2, '<b>CONTACT PERSON WITH TEL,FAX</b>', $font, $parFormat);
$table->writeToCell(9, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(10, 2, '<b>MOVEMENT SUBJECT TO SINGLE/MULTIPLE</b>', $font, $parFormat);
$table->writeToCell(10, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(11, 1, '<b>3.</b>', $font, $parFormat);
$table->writeToCell(11, 2, '<b>CORRESPONDING TO APPLICANT REF .NO ,IF ANY</b>', $font, $parFormat);
$table->writeToCell(11, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(12, 1, '<b>4.</b>', $font, $parFormat);
$table->writeToCell(12, 2, "<b>BILL OF Laden</b>", $font, $parFormat);
$table->writeToCell(12, 3, "<b>$row->bl_number</b>", $font, $parFormat);
 
$table->writeToCell(13, 1, '<b>5.</b>', $font, $parFormat);
$table->writeToCell(13, 2, '<b>DESIGNATION AND CHEMICAL COMPOSITION OF THE WASTE</b>', $font, $parFormat);
$table->writeToCell(13, 3, '<b>TYRES SCRAP CUT IN 2 &3 PCS (ARISES FROM USED & OLD TYRES)</b>', $font, $parFormat);
 
 
$table->writeToCell(14, 1, '<b>6.</b>', $font, $parFormat);
$table->writeToCell(14, 2, '<b>PHYSICAL CHARACTERISTICS(3)</b>', $font, $parFormat);
$table->writeToCell(14, 3, '<b>SOLID</b>', $font, $parFormat);
 
$table->writeToCell(15, 1, '<b>7.</b>', $font, $parFormat);
$table->writeToCell(15, 2, '<b>ACTUAL QUANTITY KG/LITRE</b>', $font, $parFormat);
$table->writeToCell(15, 3, '<b>26.500 MT</b>', $font, $parFormat);
 
$table->writeToCell(16, 1, '<b>8.</b>', $font, $parFormat);
$table->writeToCell(16, 2, '<b>WASTE IDENTIFICATION CODE</b>', $font, $parFormat);
$table->writeToCell(16, 3, '<b>R CODE /D CODE : R3</b>', $font, $parFormat);
 
$table->writeToCell(17, 2, '<b>BASEL NO.</b>', $font, $parFormat);
$table->writeToCell(17, 3, '<b>1K,B 3140</b>', $font, $parFormat);
 
$table->writeToCell(18, 2, '<b>OECD NO</b>', $font, $parFormat);
$table->writeToCell(18, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(19, 2, '<b>UN NO.</b>', $font, $parFormat);
$table->writeToCell(19, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(20, 2, '<b>ITC (HS)</b>', $font, $parFormat);
$table->writeToCell(20, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(21, 2, '<b>CUSTOMS CODE(H.S)</b>', $font, $parFormat);
$table->writeToCell(21, 3, '<b>4004 00 00</b>', $font, $parFormat);
 
$table->writeToCell(22, 2, '<b>OTHER (SPECIFY)</b>', $font, $parFormat);
$table->writeToCell(22, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(23, 2, '<b>BILL OF LADING </b>', $font, $parFormat);
$table->writeToCell(23, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(24, 1, '<b>9.</b>', $font, $parFormat);
$table->writeToCell(24, 2, '<b>OECD CLASSIFICATION (2)
(A) AMBER/RED/OTHER (ATTACH DETAILS)
(B) NUMBER
</b>', $font, $parFormat);
$table->writeToCell(24, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(25, 1, '<b>10.</b>', $font, $parFormat);
$table->writeToCell(25, 2, '<b>PACKING TYPE(3)</b>', $font, $parFormat);
$table->writeToCell(25, 3, '<b>LOOSE</b>', $font, $parFormat);
 
$table->writeToCell(26, 2, '<b>NUMBER</b>', $font, $parFormat);
$table->writeToCell(26, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(27, 1, '<b>11.</b>', $font, $parFormat);
$table->writeToCell(27, 2, '<b>UN CLASSIFICATION</b>', $font, $parFormat);
$table->writeToCell(27, 3, '<b>NA</b>', $font, $parFormat);
 
$table->writeToCell(28, 2, '<b>UN SHIPPING NAME</b>', $font, $parFormat);
$table->writeToCell(28, 3, '<b>SCI</b>', $font, $parFormat);
 
$table->writeToCell(29, 2, '<b>UN IDENTIFICATION NO.</b>', $font, $parFormat);
$table->writeToCell(29, 3, '<b>NA</b>', $font, $parFormat);
 
$table->writeToCell(30, 2, '<b>UN CLASS(3)</b>', $font, $parFormat);
$table->writeToCell(30, 3, '<b>NA</b>', $font, $parFormat);
 
$table->writeToCell(31, 2, '<b>H NUMBER(3)</b>', $font, $parFormat);
$table->writeToCell(31, 3, '<b>NA</b>', $font, $parFormat);
 
$table->writeToCell(32, 2, '<b>Y NUMBER</b>', $font, $parFormat);
$table->writeToCell(32, 3, '<b>NA</b>', $font, $parFormat);
 
$table->writeToCell(35, 1, '<b>12.</b>', $font, $parFormat);
$table->writeToCell(35, 2, '<b>SPECIAL HANDLING REQUIREMENTS</b>', $font, $parFormat);
$table->writeToCell(35, 3, '<b>NO</b>', $font, $parFormat);
 
$table->writeToCell(36, 1, '<b>13.</b>', $font, $parFormat);
$table->writeToCell(36, 2, "<b>EXPORTER'S DECLARATION FOR HAZARDOUS WASTE:
I CERTIFY THAT THE INFORMATION IN SL.NO. 1 OF 12 ABOVE
IS COMPLETE AND COORECT TO MY BEST KNOWLEDGE I
ALSO CERTIFY THAT LEGALLY ENFORCEABLE WRII1EN
CONTRACTUAL OBLIGATIONS HAVE BEEN ENTERED INTO
AND ARE IN FORCE COVERING THE TRANSBOUNDARY
</b>", $font, $parFormat);
$table->writeToCell(36, 3, '<b>-</b>', $font, $parFormat);
 
$table->writeToCell(37, 1, '<b>14.</b>', $font, $parFormat);
$table->writeToCell(37, 2, '<b>NAME:</b>', $font, $parFormat);
$table->writeToCell(37, 3, '<b>Paul Gunn</b>', $font, $parFormat);
 
$table->writeToCell(38, 1, '<b>15.</b>', $font, $parFormat);
$table->writeToCell(38, 2, '<b>DATE:
SIGNATURE WITH STAMP
</b>', $font, $parFormat);
$table->writeToCell(38, 3, '<b></b>', $font, $parFormat);
 
$table->writeToCell(39, 1, '<b>16.</b>', $font, $parFormat);
$table->writeToCell(39, 2, '<b> INVOICE NUMBER</b>', $font, $parFormat);
$table->writeToCell(39, 3, "<b>$invoice</b>", $font, $parFormat);
 
 
$parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_LEFT);
$font = new PHPRtfLite_Font(8,'Calibri (Body)');
$footer = $section->addFooter();
 
$imageFile = 'stamp.png';
 
$table = $footer->addTable();
$table->addRows(1);
$table->addColumnsList(array(5, 8, 6));
// add image to table in header
$table->writeToCell(1, 1, 'Carbora Environmental Limited<br>72 North Road<br>Richmond<br>TW9 4HQ<br>England', $font, $parFormat);
$table->writeToCell(1, 2, 'enquiries@carboraenvironmental.com<br>www.carboraenvironmental.com<br><br><br>Registered in England     Company No 9321437', $font, $parFormat);
$image = $table->addImageToCell(1, 3, $imageFile);
 
}
// Save the file
$rtf->save('directors_declaration_form.doc');
 
$file_name = 'directors_declaration_form.doc';
header("Content-disposition: attachment; filename=".basename($file_name)."");
header('Content-type: application/doc');
readfile($file_name);
 
?>
Edited by cyberRobot
added code tags
Link to comment
https://forums.phpfreaks.com/topic/298342-help-please/#findComment-1521720
Share on other sites

Maybe it's this one?

 

<?php

include('config.php');
extract($_GET);
$sql = mysql_query("SELECT * FROM custom_doc WHERE invoice = '$invoice' ");
$row = mysql_fetch_object($sql);
?>
 
<html>
<head></head>
<body>
<div style="border:2px solid black;padding:10px">
<form method="post" action="index.php">
<table style="line-height:35px">
    <tr>
        <td>Invoice Date</td>
            <td><input type="date" name="inv_date" value="<?php echo date('Y-m-d',strtotime($row->inv_date)); ?>" /></td>
            <td>Sail Date</td>
            <td><input type="date" name="sail_date" value="<?php echo date('Y-m-d',strtotime($row->sail_date)); ?>" /></td>
            <td>B/L Number</td>
            <td><input type="text" name="bl_number" size="10" value="<?php echo $row->bl_number; ?>" /></td>
        </tr>
        
        <tr>
            <td>Vessel Name</td>
            <td><input type="text" name="vessel_name" required="required" value="<?php echo $row->vessel_name; ?>" /></td>
            <td>Port Name</td>
            <td><input type="text" name="port_name" required="required" size="15" value="<?php echo $row->port_name; ?>" /></td>
            <td>PL number</td>
            <td><input type="text" name="pl_number" required="required" size="10" value="<?php echo $row->pl_number; ?>" /></td>
 
        </tr>
            
        
        <tr>
        <td>Container number 1</td>
            <td><input type="text" name="container_number_1" size="10"  value="<?php echo $row->container_number_1; ?>"  /></td>
            <td>Container number 2</td>
            <td><input type="text" name="container_number_2" size="10"  value="<?php echo $row->container_number_2; ?>"  /></td>
            <td>Container number 3</td>
            <td><input type="text" name="container_number_3" size="10"  value="<?php echo $row->container_number_3; ?>"  /></td>
        </tr>
        
        
        <tr>
        <td>Container number 4</td>
            <td><input type="text" name="container_number_4" size="10"  value="<?php echo $row->container_number_4; ?>"  /></td>
            <td>Container number 5</td>
            <td><input type="text" name="container_number_5" size="10"  value="<?php echo $row->container_number_5; ?>"  /></td>
            <td>Container number 6</td>
            <td><input type="text" name="container_number_6" size="10"  value="<?php echo $row->container_number_6; ?>"  /></td>
        </tr>
        
        <tr>
        <td>Container number 7</td>
            <td><input type="text" name="container_number_7" size="10"  value="<?php echo $row->container_number_7; ?>"  /></td>
            <td>Container number 8</td>
            <td><input type="text" name="container_number_8" size="10"  value="<?php echo $row->container_number_8; ?>"  /></td>
            <td>Container number 9</td>
            <td><input type="text" name="container_number_9" size="10"  value="<?php echo $row->container_number_9; ?>"  /></td>
        </tr>
                
        <tr>
        <td>Container number 10</td>
            <td><input type="text" name="container_number_10" size="10"  value="<?php echo $row->container_number_10; ?>"  /></td>
            <td>Container number 11</td>
            <td><input type="text" name="container_number_11" size="10"  value="<?php echo $row->container_number_11; ?>"  /></td>
            <td>Container number 12</td>
            <td><input type="text" name="container_number_12" size="10"  value="<?php echo $row->container_number_12; ?>"  /></td>
        </tr>
        
        <tr>
        <td>Container number 13</td>
            <td><input type="text" name="container_number_13" size="10" value="<?php echo $row->container_number_13; ?>" /></td>
            <td>Container number 14</td>
            <td><input type="text" name="container_number_14" size="10" value="<?php echo $row->container_number_14; ?>" /></td>
            <td>Container number 15</td>
            <td><input type="text" name="container_number_15" size="10" value="<?php echo $row->container_number_15; ?>" /></td>
        </tr>
        
        <tr>
        <td>Seal Number 1</td>
            <td><input type="text" name="seal_number_1" size="10" value="<?php echo $row->seal_number_1; ?>" /></td>
            <td>Seal number 2</td>
            <td><input type="text" name="seal_number_2" size="10" value="<?php echo $row->seal_number_2; ?>" /></td>
            <td>Seal number 3</td>
            <td><input type="text" name="seal_number_3" size="10" value="<?php echo $row->seal_number_3; ?>" /></td>
        </tr>
        
        <tr>
        <td>Seal Number 4</td>
            <td><input type="text" name="seal_number_4" size="10" value="<?php echo $row->seal_number_4; ?>" /></td>
            <td>Seal number 5</td>
            <td><input type="text" name="seal_number_5" size="10" value="<?php echo $row->seal_number_5; ?>" /></td>
            <td>Seal number 6</td>
            <td><input type="text" name="seal_number_6" size="10" value="<?php echo $row->seal_number_6; ?>" /></td>
        </tr>
        
        <tr>
        <td>Seal Number 7</td>
            <td><input type="text" name="seal_number_7" size="10" value="<?php echo $row->seal_number_7; ?>" /></td>
            <td>Seal number 8</td>
            <td><input type="text" name="seal_number_8" size="10" value="<?php echo $row->seal_number_8; ?>" /></td>
            <td>Seal number 9</td>
            <td><input type="text" name="seal_number_9" size="10" value="<?php echo $row->seal_number_9; ?>" /></td>
        </tr>
        
        <tr>
        <td>Seal Number 10</td>
            <td><input type="text" name="seal_number_10" size="10" value="<?php echo $row->seal_number_10; ?>" /></td>
            <td>Seal number 11</td>
            <td><input type="text" name="seal_number_11" size="10" value="<?php echo $row->seal_number_11; ?>" /></td>
            <td>Seal number 12</td>
            <td><input type="text" name="seal_number_12" size="10" value="<?php echo $row->seal_number_12; ?>" /></td>
        </tr>
        
        <tr>
        <td>Seal Number 13</td>
            <td><input type="text" name="seal_number_13" size="10" value="<?php echo $row->seal_number_13; ?>" /></td>
            <td>Seal number 14</td>
            <td><input type="text" name="seal_number_14" size="10" value="<?php echo $row->seal_number_14; ?>" /></td>
            <td>Seal number 15</td>
            <td><input type="text" name="seal_number_15" size="10" value="<?php echo $row->seal_number_15; ?>" /></td>
        </tr>
        <input type="hidden" name="invoice" value="<?php echo $invoice; ?>" >
        <tr>
        <td colspan="6" align="right"><input type="submit" name="edit_invoice" value="Edit Invoice" style="width:150px;height:30px;" /></td>
        </tr>
        
        
    </table>
</form>
 
</div>
 
 
</body>
</html>
 
 

post-179842-0-97740800-1443467841_thumb.png

Link to comment
https://forums.phpfreaks.com/topic/298342-help-please/#findComment-1521750
Share on other sites

1 - try turning on php error checking at the very top of your scripts.

2 - do some debugging. At the point that you THINK you have prepared the data to be inserted into the word template, dump it out to the screen and check it.

 

If your script is failing before that, insert some echos at various points leading up to that to be sure that you are getting that var.

 

This is what programmers do.

Link to comment
https://forums.phpfreaks.com/topic/298342-help-please/#findComment-1521808
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.