Forum Moderators: coopster
<form action="create_pdf_shipping_label.php" method="POST">
<input name="requestid" type="text"/>
<input name="submit" type="submit" value="Submit" />
</form>
<?php
error_reporting(E_ALL|E_STRICT);
require_once("connections/connection.php"); // Connection to the server
require_once('fpdf/fpdf.php'); //FPDF classes
$tbl_name="sample_requests"; // Table name
$requestid = ($_POST['requestid']);
$query = "SELECT * FROM $tbl_name WHERE request = $requestid ";
$result = mysql_query($query) or die('Error, query failed');
while($rows = mysql_fetch_array($result));
{
$firstname = $rows['firstname'];
$pdf=new FPDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial','B',14);
$pdf->SetMargins(0,0);
$pdf->SetAutoPageBreak(false);
$pdf->Text(40,10,$firstname);
$pdf->Output('mailing_labels.pdf','D');
}
?>
$pdf->Write(5,$result['firstname']); and not $pdf->Write(5, $firstname); <?php
error_reporting(E_ALL|E_STRICT);
require_once("connections/connection.php"); // Connection to the server
require_once('fpdf/fpdf.php'); //FPDF classes
$tbl_name="sample_requests"; // Table name
$query = "SELECT * FROM $tbl_name WHERE request = 2 ";
$result = mysql_query($query) or die('Error, query failed');
while($rows = mysql_fetch_array($result));
{
$pdf=new FPDF();
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial','B',14);
$pdf->SetMargins(0,0);
$pdf->SetAutoPageBreak(false);
$pdf->Write(5,$rows['firstname']);
$pdf->Output('mailing_labels.pdf','D');
}
?> I'm looking to export the name and address from the database and produce a PDF that I can then print as a shipping label.
Thought I was working along the right lines but I'm starting to think that I'm miles off!