Ok, więc tak
krok.php<?php
$_GET['krok'];
default:
break;
case '1':
include('krok1.php');
break;
case '2':
echo "<form name='generator' action='?krok=3' method='POST'>";
include('krok2.php');
echo "<input type='hidden' name='krok' value='3'> <input type='submit' name='dalej' value='Idź dalej'>
</form>";
break;
}
?>
krok1.php<?php
<head>
<title>.: Formularz druku listu poleconego :. </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>List polecony</h1>
<form method="post" action="krok.php?krok=2">
Numer listu: <input type="text" name="numer_przesylki" value="" size="22"/> <br/><br/>
<br/>
<br/>
<b>Nadawca:</b>
<br/>
Nazwa nadawcy L1: <input type="text" name="n_nazwa_l1" value="Przykładowy sklep internetowy" size="22"/><br/>
Nazwa nadawcy L2: <input type="text" name="n_nazwa_l2" value="Linia2" size="22"/><br/>
Ulica, numer / lokal: <input type="text" name="n_adres" value="Uliczna " size="23"/><br/>
Kod: <input type="text" name="n_kod"/ value="00-000" size="2"> Miasto: <input type="text" name="n_miasto" value="Miasteckowo" size="21"/><br/>
<br />
<b>Odbiorca:</b>
<br/>
Nazwa odbiorcy L1: <input type="text" name="o_nazwa_l1" size="22"/><br/>
Nazwa odbiorcy L2: <input type="text" name="o_nazwa_l2" size="22"/><br/>
Ulica, numer / lokal: <input type="text" name="o_adres" size="23"/><br/>
Kod: <input type="text" name="o_kod" size="2"/> Miasto: <input type="text" name="o_miasto" size="21"/><br/>
<br/>
<input type="submit" value="Generuj"/>
</form>
</body>
</html>';
?>
Krok2.php<?php
include('php-barcode.php'); // KODY
// Przesył danych
$_POST["numer_przesylki"];
$_POST["n_nazwa_l1"];
$_POST["n_nazwa_l2"];
$_POST["n_adres"];
$_POST["n_kod"];
$_POST["n_miasto"];
$_POST["o_nazwa_l1"];
$_POST["o_nazwa_l2"];
$_POST["o_adres"];
$_POST["o_kod"];
$_POST["o_miasto"];
$dane['n_nazwa_l1'] = $_POST["n_nazwa_l1"];
$dane['n_nazwa_l2'] = $_POST["n_nazwa_l2"];
$dane['n_adres'] = $_POST["n_adres"];
$dane['n_kod'] = $_POST["n_kod"];
$dane['n_miasto'] = $_POST["n_miasto"];
$dane['o_nazwa_l1'] = $_POST["o_nazwa_l1"];
$dane['o_nazwa_l2'] = $_POST["o_nazwa_l2"];
$dane['o_adres'] = $_POST["o_adres"];
$dane['o_kod'] = $_POST["o_kod"];
$dane['o_miasto'] = $_POST["o_miasto"];
//kody
$fontSize = 10; // GD1 in px ; GD2 in point
$marge = 4; // between barcode and hri in pixel // margines od tekstu
$x = 200; // barcode center
$y = 13; // barcode center
$height = 20; // barcode height in 1D ; module size in 2D
$width = 2; // barcode height in 1D ; not use in 2D
$angle = 0; // rotation in degrees : nb : non horizontable barcode might not be usable because of pixelisation
$code = $_POST["numer_przesylki"]; //'(00)659007731731304756'; // barcode, of course ;)
$type = 'code128';
//Druk
$image = imagecreatetruecolor(575, 430); //deklaracja wielkości obrazka
$white = imagecolorallocate($image, 255, 255, 255); // biały
$black = imagecolorallocate($image, 0, 0, 0); // czarny
$font = 'arial.ttf'; //deklaracja czcionki
imagefilledrectangle($image, 0, 0, 575, 430, $white); //tworzy tło
ImageSetThickness($image, 3); // określenie szerokości
imageline($image, 5,5, 570, 5, $black); //górna
imageline($image, 5, 425, 570, 425, $black); // dolna
imageline($image, 5,5, 5, 425, $black); // lewa
imageline($image, 570 ,5, 570, 425, $black); // lewa
imageline($image, 328, 82, 328, 425, $black); //środkowa
imageline($image, 5, 82, 329, 82, $black); //górna
imageline($image, 5, 253, 329, 253, $black); //dolna
//Pieczęć pocztowa
imageellipse($image, 451 ,335, 75, 75, $black); // lewa
imagettftext($image, 9, 0, 390, 390, $black, $font, "Podpis przyjmującego");
//Napisy główne
imagettftext($image, 19, 0, 125, 32, $black, $font, "POTWIERDZENIE NADANIA");
imagettftext($image, 10, 0, 20, 52, $black, $font, "przesyłki poleconej nr:");
imagettftext($image, 16, 0, 13, 105, $black, $font, "NADAWCA:");
imagettftext($image, 16, 0, 13, 276, $black, $font, "ADRESAT:");
imagettftext($image, 12, 0, 349, 110, $black, $font, "Opłata ......................zł ..........gr");
imagettftext($image, 12, 0, 349, 147, $black, $font, "Masa ..................kg ..............g");
imagettftext($image, 12, 0, 349, 184, $black, $font, "GABARYT A B");
imagettftext($image, 12, 0, 349, 220, $black, $font, "Priorytetowa");
imagettftext($image, 12, 0, 349, 255, $black, $font, "Potwierdzenie odbioru");
imagettftext($image, 7, 0, 440, 420, $black, $font, "Wygenerowano automatycznie");
//Kratki (pola)
imageline($image, 459, 158, 459, 190, $black); //środkowa
imageline($image, 491, 158, 491, 190, $black); //środkowa
imageline($image, 459, 158, 491, 158, $black); //środkowa
imageline($image, 459, 190, 491, 190, $black); //środkowa
imageline($image, 459, 198, 459, 230, $black); //środkowa
imageline($image, 491, 198, 491, 230, $black); //środkowa
imageline($image, 459, 198, 491, 198, $black); //środkowa
imageline($image, 459, 230, 491, 230, $black); //środkowa
imageline($image, 515, 158, 547, 158, $black); //górna
imageline($image, 515, 190, 547, 190, $black); //dolna
imageline($image, 515, 158, 515, 190, $black); //lewa
imageline($image, 547, 158, 547, 190, $black); //prawa
imageline($image, 515, 233, 547, 233, $black); //górna
imageline($image, 515, 265, 547, 265, $black); //dolna
imageline($image, 515, 233, 515, 265, $black); //lewa
imageline($image, 547, 233, 547, 265, $black); //prawa
imageline($image, 5, 82, 329, 82, $black); //górna
imageline($image, 5, 253, 329, 253, $black); //dolna
// Nadawca
imagettftext($image, 14, 0, 13, 150, $black, $font, $dane['n_nazwa_l1']);
imagettftext($image, 14, 0, 13, 180, $black, $font, $dane['n_nazwa_l2']);
imagettftext($image, 14, 0, 13, 210, $black, $font, $dane['n_adres']);
imagettftext($image, 14, 0, 13, 240, $black, $font, $dane['n_kod']);
imagettftext($image, 14, 0, 93, 240, $black, $font, $dane['n_miasto']);
// Adresat
imagettftext($image, 14, 0, 13, 320, $black, $font, $dane['o_nazwa_l1']);
imagettftext($image, 14, 0, 13, 350, $black, $font, $dane['o_nazwa_l2']);
imagettftext($image, 14, 0, 13, 380, $black, $font, $dane['o_adres']);
imagettftext($image, 14, 0, 13, 410, $black, $font, $dane['o_kod']);
imagettftext($image, 14, 0, 93, 410, $black, $font, $dane['o_miasto']);
function drawCross($im, $color, $x, $y){
imageline($im, $x - 10, $y, $x + 10, $y, $color);
imageline($im, $x, $y- 10, $x, $y + 10, $color);
}
// -------------------------------------------------- //
// ALLOCATE GD RESSOURCE
// -------------------------------------------------- //
$im = imagecreatetruecolor(400, 42);
$black = ImageColorAllocate($im,0x00,0x00,0x00);
$white = ImageColorAllocate($im,0xFF,0xFF,0xFF);
$red = ImageColorAllocate($im,0xff,0x00,0x00);
$blue = ImageColorAllocate($im,0x00,0x00,0x00);
imagefilledrectangle($im, 0, 0, 400, 55, $white);
// -------------------------------------------------- //
// BARCODE
// -------------------------------------------------- //
$data = Barcode
::gd($im, $black, $x, $y, $angle, $type, array('code'=>$code), $width, $height);
// -------------------------------------------------- //
// HRI
// -------------------------------------------------- //
$box = imagettfbbox($fontSize, 0, $font, $data['hri']);
$len = $box[2] - $box[0];
Barcode::rotate(-$len / 2, ($data['height'] / 2) + $fontSize + $marge, $angle, $xt, $yt);
imagettftext($im, $fontSize, $angle, $x + $xt, $y + $yt, $blue, $font, $data['hri']);
}
/////////////// koniec kodów kreskowych///
imagecopymerge($image, $im, 165, 35, 0, 0, imagesx($im), imagesy($im), 100);
header("Content-type: image/png"); imagePNG($image);
imagedestroy($image);
?>
No i jak teraz?