我需要在HTML表單上提交數據時將數據傳輸到MYSQL數據庫中進行更新,併爲提交的數據生成pdf。這還必須包含增量值,例如生成收據編號。無法使用php和mysql將數據從HTML表單解析爲PDF
我的pdf代碼在這裏腳本在php中。
<?php
require('fpdf.php');
class PDF extends FPDF
{
//Page header
function Header()
{
//Move to the right
$this->Cell(130);
//Title
include('connection.php');
mysql_select_db("inventory") or die("Couldn't find db");
$data = mysql_query("SELECT * FROM sold WHERE imei = '6135352313'");//This is where i need help how to get data from the HTML form after updating in MYSQL
while ($result1 = mysql_fetch_assoc($data))
{
$this->Cell(50,10,'CP '.$result1["receiptnumber"],1,1,'C'); //receipt number to be pulled from Auto_increment field in database
}
//Move to the right
$this->Cell(130);
//Date
$this->Cell(50,10,date("l F dS Y "),1,0,'C');
//Line break
$this->Ln(20);
}
//Instanciation of inherited class
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial','B',10);
include('connection.php');
mysql_select_db("inventory") or die("Couldn't find db");
$data = mysql_query("SELECT * FROM sold WHERE imei = '6135352313'"); //This is where i need help how to get data from the HTML form after updating in MYSQL
while ($result = mysql_fetch_assoc($data))
{
//Move to the right
$pdf->Cell(50,5,'Invoice To ',0,0,'R');
$pdf->SetFont('Arial','B',15);
$pdf->Cell(140,8,$result["firstname"]." ".$result["lastname"],1,1,'C');
$pdf->SetFont('Arial','B',10);
}
$pdf->Output();
?>
你的問題是什麼? – 2011-06-10 15:45:32
@ tomalak-geretkal我的問題是從HTML表單中獲取數據以便在mysql中更新爲唯一的標識符並生成帶有唯一標識符的pdf。我能夠做到這一點,只有當我手動給imei一個明確的價值時,imei字段沒有被腳本自己填充。另外,我評論了我需要幫助的領域。 – darsh 2011-06-10 15:48:08