Address Labels
← Return
I often need a way to convert a CSV file into a set of Avery address labels that can be printed out.

The following demos show two options for the order of appearance:
1) Labels in the order they appear on the spreadsheet DEMO1
2 Labels in street address order - useful for neighborhood directories DEMO2
Labels 1 Code
Download
LABELS1/index.php ▾
<?php
//Produces a page of address labels that can be saved as a pdf and printed
//
//Requires a csv file with the following columns: name (or lastname and firstname) address (or street number and street name), city, state and zip
//Labels printed in order they appear on spreadsheet
// Preload default csv file in case user does not provide one
copy ('inc/FCS.csv', 'temp.csv');
include ("inc/header.php");
if ($_SERVER ["REQUEST_METHOD"] == "POST" ) {
$error = false;
if ($_FILES['uploadfile1']['name'] !== ''){
$imagebase1 = $_FILES['uploadfile1']['name'];
$imagename = pathinfo ($imagebase1, PATHINFO_FILENAME);
$extension = strtolower (pathinfo ($imagebase1, PATHINFO_EXTENSION));
if($extension === 'csv'&& $_FILES["uploadfile1"]["size"] < 1000000 ) {
$fileTmpName = $_FILES['uploadfile1']['tmp_name'];
move_uploaded_file($fileTmpName, 'temp.csv');
}
else {
$error = true;
echo "<h3 style='color: red'>File must be type 'csv' and less than 1 MB)</h3>";
unlink ('temp.csv');
}
}
if ($error === false) {
include ("inc/convert-csv-file-to-array.php");
include ("inc/set-up-labels.php");
unlink ('temp.csv');
}
}
else {
?>
<a class = 'return' href = '../../address-labels'>← Return</a><br><br>
<div class = 'formpage'>
<h1>Create Labels from CSV file </h1><br>
<h4>Spreadsheet Rows: name (or firstname and lastname), address (or street number and street name), city, state and zip </h4>
<h4>Headings can be upper or lower case and contain spaces </h4>
<h4>Click 'enter' to see preloaded data</h4></label><br><br>
<form action="index.php" method="post" enctype="multipart/form-data">
<label for = 'uploadfile1'>Select csv file:</label><br><br>
<input id = 'uploadfile1' type="file" name="uploadfile1" ><br><br>
<input type = 'submit' name = 'submit' value = 'Enter' />
</form>
</div>
<?php
}
include ("inc/footer.php");
?>
LABELS1/inc
FCS.csv ▾
LASTNAME,FIRSTNAME,ADDRESS,CITY,STATE,ZIP,EMAIL,CELLPHONE,HOMEPHONE
Cat,Bob,421 Lower Treetrunk Drive,Felinia,OH,45150,bobcat772@catmail.com,(770) 111-2222,
Gigglesnark,Henrietta,3 Cheeseburger Circle,Felinia,OH,45150,Hgiggle@meowmail.com,(770) 111-2222,
Ritzsimmons,Mitzy,15 Hideaway Court,Felinia,OH,45150,Mitzy55@catmail.com,(770) 111-2222,
Shaggyback,Snow,194 North Arctic Avenue,Felinia,OH,45150,Sshaggy@catmail.com,(770) 111-2222,
Pawclaw,Martin and Betty,250 Mousetail Blvd,Felinia,OH,45150,MBPawclaw@catmail.com,(770) 111-2222,(770) 111-2222
Bluewhisker,Josephina,251 Mousetail Blvd,Felinia,OH,45150,Jblue222@meowmail.com,(770) 111-2222,
Calico,Gordon and Ophelia,21449 Longtail Road,Felinia,OH,45150,GOCalico414@catmail.com,(770) 111-2222,
Chaserson,Prissy,8 Feathertoy Circle,Felinia,OH,45150,Prissy1@purrmail.com,(770) 111-2222,
Jones,Cleopatra,314 Squared Circle,Felinia,OH,45150,Cleo30BC@catmail.com,(770) 111-2222,
Softpaw,Blackie,2 Dark Lane,Felinia,OH,45150,BlackieSoftpaw@meowmail.com,(770) 111-2222,
Snowball,Larry and Lucy,9 Feathertoy Circle,Felinia,OH,45150,LarryLucySnow@meowmail.com,(770) 111-2222,(770) 111-2222
Twitchitail,Tom and Ginger,45 Leafy Lane,Felinia,OH,45150,Twitch17@purrmail.com,(770) 111-2222,(770) 111-2222
Feliniov,Boris and Natasha,5 Dark Lane,Felinia,OH,45150,BNFeliniov@catmail.com,(770) 111-2222,
Armstrong,Antonio,252 Mousetail Blvd,Felinia,OH,45150,Aarmstrong@meowmail.com,(770) 111-2222,
Sheddington,Fluffy,195 North Arctic Avenue,Felinia,OH,45150,Fluffy1@purrmail.com,(770) 111-2222,
Dieter,Isley,5 Cheeseburger Circle,Felinia,OH,45150,IsleyD@meowmail.com,(770) 111-2222,
Dieter,Ralph,1 Cheeseburger Circle,Felinia,OH,45150,Ralph@meowmail.com,(770) 111-2222,
Rodgers,Holly,46 Leafy Lane,Felinia,OH,45150,HRod19@catmail.com,(770) 111-2222,
Rodgers,Willow,16 Hideaway Court,Felinia,OH,45150,WRod22@catmail.com,(770) 111-2222,
Rodgers,Scottie,252 Mousetail Blvd,Felinia,OH,45150,Scotrod78@catmail.com,(770) 111-2222,
Patterson,Princess,48 Longtail Court,Felinia,OH,45150,PrincessP@catmail.com,(770) 111-2222,
Patterson,Catzilla,422 Lower Treetrunk Drive,Felinia,OH,45150,CatzillaP@catmail.com,(770) 111-2222,
Rodgers,Squeekie,17 Hideaway Court,Felinia,OH,45150,SqueekRod@meowmail.com,(770) 111-2222,
Rodgers,Tanster,42 Leafy Lane,Felinia,OH,45150,TanROd@meowmail.com,(770) 111-2222,
Armstrong,Mercedes,9 Dark Lane,Felinia,OH,45150,MerArm67@meowmail.com,(770) 111-2222,
Softpaw,Mittens,7 Cheeseburger Circle,Felinia,OH,45150,MittensS@purrmail.com,(770) 111-2222,
Softpaw,Simkin,43 Longtail Court,Felinia,OH,45150,SSoft2525@purrmail.com,(770) 111-2222,
Patterson,Pinkie,255 Mousetail Blvd,Felinia,OH,45150,PinkieP@purrmail.com,(770) 111-2222,
Pantherson,Peter,50 Leafy Lane,Felinia,OH,45150,PeterP@purrmail.com,(770) 111-2222,(770) 111-2222
Kerspeckles,Wilhelmina,12 Feathertoy Circle,Felinia,OH,45150,WKersp671@catmail.com,(770) 111-2222,
Cat,Kitty,52 Leafy Lane,Felinia,OH,45150,KC6722@purrmail.com,(770) 111-2222,
Cat,Bunny,300 Mousetail Blvd,Felinia,OH,45150,BunnC25@catmail.com,(770) 111-2222,
Feliniov,Ivan and Caterina,380 Lower Treetrunk Drive,Felinia,OH,45150,ICFeliniov18@catmail.com,(770) 111-2222,(770) 111-2222
Cat,Baby,45 Longtail Court,Felinia,OH,45150,BC4938@meowmail.com,(770) 111-2222,
Pantherson,Bitsy,4 Dark Lane,Felinia,OH,45150,BitPan16@meowmail.com,(770) 111-2222,
Thagorus,Py,300 Squared Circle,Felinia,OH,45150,PyThag314@meowmail.com,(770) 111-2222,
Rachio,Goldy,307 Squared Circle,Felinia,OH,45150,GRachio618@meowmail.com,(770) 111-2222,
Mewton,Isaac,302 Squared Circle,Felinia,OH,45150,IMew1790@purrmail.com,(770) 111-2222,
assign-names-to-array-values.php ▾
<?php
$name = $lastname = $firstname = $streetnumber = $streetname = $address = $city = $state = $zip = '';
if (array_key_exists ('streetname', $row) ) {
$streetname = $row['streetname'];
}
if (array_key_exists ('streetnumber', $row) ) {
$streetnumber = $row['streetnumber'];
}
if (array_key_exists ('address', $row)) {
$address = $row ['address'];
}
if ( (!$streetnumber || !$streetname) && $address) {
$pos1 = strpos ($address, ' ');
$streetnumber = substr ($address, 0, $pos1);
$streetname = substr ($address, $pos1 + 1);
}
if (!$address) {
$address = $streetnumber . ' ' . $streetname;
}
if (array_key_exists ('name', $row)) {
$name = $row['name'];
}
if (array_key_exists ('lastname', $row) ) {
$lastname = $row['lastname'];
}
if (array_key_exists ('firstname', $row) ) {
$firstname = $row['firstname'];
}
if (! $name) {
if ($firstname && $lastname) {
$name = $firstname . " " . $lastname;
}
}
if (array_key_exists ('city', $row) ) {
$city = $row['city'];
}
if (array_key_exists ('state', $row) ) {
$state = $row['state'];
}
if (array_key_exists ('zip', $row) ) {
$zip = $row['zip'];
}
?>
convert-csv-file-to-array.php ▾
<?php
$file = fopen('temp.csv',"r");
$keyarray = $addressarray = array();
$count = 0;
while(! feof($file)){
$array1 = fgetcsv($file);
if ($array1) {
if ($count === 0) {
//create keys for associative array
foreach ($array1 as $item1) {
$item1 = preg_replace('/[^A-Za-z0-9-?!,\s\/]/', '', $item1);
$item1 = str_replace (' ', '', $item1);
$item1 = strtolower($item1);
if (strpos ($item1, 'zip') !== false) {
$item1 = 'zip';
}
if (strpos ($item1, 'state') !== false) {
$item1 = 'state';
}
array_push ($keyarray, $item1);
}
}
else {
$row = array();
foreach ($keyarray as $id => $key) {
if (array_key_exists ($id, $array1)) {
$row[$key] = $array1[$id];
}
}
array_push ($addressarray, $row);
}
}
$count++;
}
fclose($file);
?> footer.php ▾
</div>
</body>
</html> header.php ▾
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title></title>
<link rel= 'stylesheet' type='text/css' href= 'inc/style.css'>
<meta name = 'robots' content = 'nofollow,noindex'>
</head>
<body>
<div class = 'outerwrap'>
<!-- <h1>Compare EMS and HOA members</h1> -->
set-up-labels.php ▾
<?php
$allcounter = 0;
$counter = 0;
echo "<div class = 'label-page' >";
foreach ($addressarray as $row) {
if ($counter === 0){
echo "<div class = 'label-element1'>";
$counter++;
}
else if ($counter === 1) {
echo "<div class = 'label-element2'>";
$counter++;
}
else if ($counter === 2) {
echo "<div class = 'label-element3'>";
$counter = 0;
}
include ('inc/assign-names-to-array-values.php');
echo "<div class = 'inner-label'>";
echo $name . " <br>" . $address . "<br> " . $city . ", " . $state . " " . $zip ;
echo "</div>";
echo "</div>";
$allcounter++;
if ($allcounter === 30) {
echo "</div><div class = 'pdf-page-break'>";
$allcounter = 0;
}
}
echo "</div>"; style.css ▾
.label-page {
padding: 70px 20px 0 20px ;
}
.label-element1, .label-element2, .label-element3 {
width: 35%;
display: inline-block;
vertical-align: top;
line-height: 120%;
box-sizing: border-box;
font-size: 13px;
max-width: 100%;
margin-bottom: 16px;
text-align: center;
font-family: 'Arial', sans-serif;
height: 80px;
}
.label-element2 {
width: 33%;
}
.label-element3 {
width: 28%;
}
.inner-label, .inner-label-return {
width: 210px;
text-align: left;
padding: 0 20px;
}
.inner-label-return {
text-align: center;
}
.label-page.return {
text-align: center;
}
footer {
display: block;
}
.formpage {
text-align: center;
font-family: 'Arial';
color: #555;
}
form {
padding-top: 60px;
}
label,input, textarea {
font-family: 'Arial', sans-serif;
}
textarea{
width: 400px;
}
label {
font-size: 18px;
font-weight: bold;
}
@media print {
.pdf-page-break {
page-break-after: always;
padding: 70px 20px 0 20px ;
}
.pdf-page-break.return {
text-align: center;
}
}
Labels 2 Code
Download
LABELS2/index.php ▾
<?php
//Produces a page of address labels that can be saved as a pdf and printed
//
//Requires a csv file with the following columns: name (or lastname and firstname) address (or street number and street name), city, state and zip
//Labels printed in street order
// Preload default csv file in case user does not provide one
copy ('inc/FCS.csv', 'temp.csv');
include ("inc/header.php");
if ($_SERVER ["REQUEST_METHOD"] == "POST" ) {
$error = false;
if ($_FILES['uploadfile1']['name'] !== ''){
$imagebase1 = $_FILES['uploadfile1']['name'];
$imagename = pathinfo ($imagebase1, PATHINFO_FILENAME);
$extension = strtolower (pathinfo ($imagebase1, PATHINFO_EXTENSION));
if($extension === 'csv'&& $_FILES["uploadfile1"]["size"] < 1000000 ) {
$fileTmpName = $_FILES['uploadfile1']['tmp_name'];
move_uploaded_file($fileTmpName, 'temp.csv');
}
else {
$error = true;
echo "<h3 style='color: red'>File must be type 'csv' and less than 1 MB)</h3>";
unlink ('temp.csv');
}
}
if ($error === false) {
include ("inc/convert-csv-file-to-array.php");
include ("inc/create-street-order-array.php") ;
include ("inc/set-up-labels.php");
unlink ('temp.csv');
}
}
else {
?>
<a class = 'return' href = '../../address-labels'>← Return</a><br><br>
<div class = 'formpage'>
<h1>Create Labels from CSV file in street order</h1><br>
<h4>Spreadsheet Rows: name (or firstname and lastname), address (or street number and street name), city, state and zip </h4>
<h4>Headings can be upper or lower case and contain spaces </h4>
<h4>Click 'enter' to see preloaded data</h4>
<form action="index.php" method="post" enctype="multipart/form-data">
<label for = 'uploadfile1'>Select csv file:</label><br><br>
<input id = 'uploadfile1' type="file" name="uploadfile1" ><br><br>
<input type = 'submit' name = 'submit' value = 'Enter' />
</form>
</div>
<?php
}
include ("inc/footer.php");
?>
LABELS2/inc
FCS.csv ▾
LASTNAME,FIRSTNAME,ADDRESS,CITY,STATE,ZIP,EMAIL,CELLPHONE,HOMEPHONE
Cat,Bob,421 Lower Treetrunk Drive,Felinia,OH,45150,bobcat772@catmail.com,(770) 111-2222,
Gigglesnark,Henrietta,3 Cheeseburger Circle,Felinia,OH,45150,Hgiggle@meowmail.com,(770) 111-2222,
Ritzsimmons,Mitzy,15 Hideaway Court,Felinia,OH,45150,Mitzy55@catmail.com,(770) 111-2222,
Shaggyback,Snow,194 North Arctic Avenue,Felinia,OH,45150,Sshaggy@catmail.com,(770) 111-2222,
Pawclaw,Martin and Betty,250 Mousetail Blvd,Felinia,OH,45150,MBPawclaw@catmail.com,(770) 111-2222,(770) 111-2222
Bluewhisker,Josephina,251 Mousetail Blvd,Felinia,OH,45150,Jblue222@meowmail.com,(770) 111-2222,
Calico,Gordon and Ophelia,21449 Longtail Road,Felinia,OH,45150,GOCalico414@catmail.com,(770) 111-2222,
Chaserson,Prissy,8 Feathertoy Circle,Felinia,OH,45150,Prissy1@purrmail.com,(770) 111-2222,
Jones,Cleopatra,314 Squared Circle,Felinia,OH,45150,Cleo30BC@catmail.com,(770) 111-2222,
Softpaw,Blackie,2 Dark Lane,Felinia,OH,45150,BlackieSoftpaw@meowmail.com,(770) 111-2222,
Snowball,Larry and Lucy,9 Feathertoy Circle,Felinia,OH,45150,LarryLucySnow@meowmail.com,(770) 111-2222,(770) 111-2222
Twitchitail,Tom and Ginger,45 Leafy Lane,Felinia,OH,45150,Twitch17@purrmail.com,(770) 111-2222,(770) 111-2222
Feliniov,Boris and Natasha,5 Dark Lane,Felinia,OH,45150,BNFeliniov@catmail.com,(770) 111-2222,
Armstrong,Antonio,252 Mousetail Blvd,Felinia,OH,45150,Aarmstrong@meowmail.com,(770) 111-2222,
Sheddington,Fluffy,195 North Arctic Avenue,Felinia,OH,45150,Fluffy1@purrmail.com,(770) 111-2222,
Dieter,Isley,5 Cheeseburger Circle,Felinia,OH,45150,IsleyD@meowmail.com,(770) 111-2222,
Dieter,Ralph,1 Cheeseburger Circle,Felinia,OH,45150,Ralph@meowmail.com,(770) 111-2222,
Rodgers,Holly,46 Leafy Lane,Felinia,OH,45150,HRod19@catmail.com,(770) 111-2222,
Rodgers,Willow,16 Hideaway Court,Felinia,OH,45150,WRod22@catmail.com,(770) 111-2222,
Rodgers,Scottie,252 Mousetail Blvd,Felinia,OH,45150,Scotrod78@catmail.com,(770) 111-2222,
Patterson,Princess,48 Longtail Court,Felinia,OH,45150,PrincessP@catmail.com,(770) 111-2222,
Patterson,Catzilla,422 Lower Treetrunk Drive,Felinia,OH,45150,CatzillaP@catmail.com,(770) 111-2222,
Rodgers,Squeekie,17 Hideaway Court,Felinia,OH,45150,SqueekRod@meowmail.com,(770) 111-2222,
Rodgers,Tanster,42 Leafy Lane,Felinia,OH,45150,TanROd@meowmail.com,(770) 111-2222,
Armstrong,Mercedes,9 Dark Lane,Felinia,OH,45150,MerArm67@meowmail.com,(770) 111-2222,
Softpaw,Mittens,7 Cheeseburger Circle,Felinia,OH,45150,MittensS@purrmail.com,(770) 111-2222,
Softpaw,Simkin,43 Longtail Court,Felinia,OH,45150,SSoft2525@purrmail.com,(770) 111-2222,
Patterson,Pinkie,255 Mousetail Blvd,Felinia,OH,45150,PinkieP@purrmail.com,(770) 111-2222,
Pantherson,Peter,50 Leafy Lane,Felinia,OH,45150,PeterP@purrmail.com,(770) 111-2222,(770) 111-2222
Kerspeckles,Wilhelmina,12 Feathertoy Circle,Felinia,OH,45150,WKersp671@catmail.com,(770) 111-2222,
Cat,Kitty,52 Leafy Lane,Felinia,OH,45150,KC6722@purrmail.com,(770) 111-2222,
Cat,Bunny,300 Mousetail Blvd,Felinia,OH,45150,BunnC25@catmail.com,(770) 111-2222,
Feliniov,Ivan and Caterina,380 Lower Treetrunk Drive,Felinia,OH,45150,ICFeliniov18@catmail.com,(770) 111-2222,(770) 111-2222
Cat,Baby,45 Longtail Court,Felinia,OH,45150,BC4938@meowmail.com,(770) 111-2222,
Pantherson,Bitsy,4 Dark Lane,Felinia,OH,45150,BitPan16@meowmail.com,(770) 111-2222,
Thagorus,Py,300 Squared Circle,Felinia,OH,45150,PyThag314@meowmail.com,(770) 111-2222,
Rachio,Goldy,307 Squared Circle,Felinia,OH,45150,GRachio618@meowmail.com,(770) 111-2222,
Mewton,Isaac,302 Squared Circle,Felinia,OH,45150,IMew1790@purrmail.com,(770) 111-2222,
assign-names-to-array-values.php ▾
<?php
$name = $lastname = $firstname = $streetnumber = $streetname = $address = $city = $state = $zip = '';
if (array_key_exists ('streetname', $row) ) {
$streetname = $row['streetname'];
}
if (array_key_exists ('streetnumber', $row) ) {
$streetnumber = $row['streetnumber'];
}
if (array_key_exists ('address', $row)) {
$address = $row ['address'];
}
if ( (!$streetnumber || !$streetname) && $address) {
$pos1 = strpos ($address, ' ');
$streetnumber = substr ($address, 0, $pos1);
$streetname = substr ($address, $pos1 + 1);
}
if (!$address) {
$address = $streetnumber . ' ' . $streetname;
}
if (array_key_exists ('name', $row)) {
$name = $row['name'];
}
if (array_key_exists ('lastname', $row) ) {
$lastname = $row['lastname'];
}
if (array_key_exists ('firstname', $row) ) {
$firstname = $row['firstname'];
}
if (! $name) {
if ($firstname && $lastname) {
$name = $firstname . " " . $lastname;
}
}
if (array_key_exists ('city', $row) ) {
$city = $row['city'];
}
if (array_key_exists ('state', $row) ) {
$state = $row['state'];
}
if (array_key_exists ('zip', $row) ) {
$zip = $row['zip'];
}
?>
convert-csv-file-to-array.php ▾
<?php
$file = fopen('temp.csv',"r");
$keyarray = $addressarray = array();
$count = 0;
while(! feof($file)){
$array1 = fgetcsv($file);
if ($array1) {
if ($count === 0) {
//create keys for associative array
foreach ($array1 as $item1) {
$item1 = preg_replace('/[^A-Za-z0-9-?!,\s\/]/', '', $item1);
$item1 = str_replace (' ', '', $item1);
$item1 = strtolower($item1);
if (strpos ($item1, 'zip') !== false) {
$item1 = 'zip';
}
if (strpos ($item1, 'state') !== false) {
$item1 = 'state';
}
array_push ($keyarray, $item1);
}
}
else {
$row = array();
foreach ($keyarray as $id => $key) {
if (array_key_exists ($id, $array1)) {
$row[$key] = $array1[$id];
}
}
array_push ($addressarray, $row);
}
}
$count++;
}
fclose($file);
?> create-street-order-array.php ▾
<?php
//Use street and street number to sort entries
$sortedarray = array();
foreach ($addressarray as $row) {
$streetname = $streetnumber = $address = $numberpadded = '';
$newrow = array();
if (array_key_exists ('streetname', $row) ) {
$streetname = $row['streetname'];
}
if (array_key_exists ('streetnumber', $row)) {
$streetnumber = $row['streetnumber'];
}
if (array_key_exists ('address', $row)) {
$address = $row ['address'];
}
//csv may have street and street number, or just address
if ($streetname && $streetnumber) {
$numberpadded = str_pad ($streetnumber, 4,'0', STR_PAD_LEFT);
}
else if ($address) {
$pos1 = strpos ($address, ' ');
$streetnumber = substr ($address, 0, $pos1);
$numberpadded = str_pad ($streetnumber, 4,'0', STR_PAD_LEFT);
$streetname = substr ($address, $pos1 + 1);
$streetname = trim ($streetname);
}
$sortingfield = $streetname . " " . $numberpadded;
$rowstring = implode (',', $row);
$rowstring = $sortingfield . "---" . $rowstring;
array_push ($sortedarray, $rowstring);
}
sort ($sortedarray);
$addressarraystreet = array();
foreach ($sortedarray as $item1){
$array2 = explode ("---", $item1);
if (array_key_exists (1, $array2)) {
$rowstring = $array2[1];
$array3 = explode (',', $rowstring);
$row = array();
//Recreate associative array of addresses in alphbetical order
foreach ($keyarray as $id => $key) {
if (array_key_exists ($id, $array3)) {
$row[$key] = $array3[$id];
}
}
array_push ($addressarraystreet, $row);
}
}
?> footer.php ▾
</div>
</body>
</html> header.php ▾
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title></title>
<link rel= 'stylesheet' type='text/css' href= 'inc/style.css'>
<meta name = 'robots' content = 'nofollow,noindex'>
</head>
<body>
<div class = 'outerwrap'>
<!-- <h1>Compare EMS and HOA members</h1> -->
set-up-labels.php ▾
<?php
$allcounter = 0;
$counter = 0;
echo "<div class = 'label-page' >";
foreach ($addressarraystreet as $row) {
if ($counter === 0){
echo "<div class = 'label-element1'>";
$counter++;
}
else if ($counter === 1) {
echo "<div class = 'label-element2'>";
$counter++;
}
else if ($counter === 2) {
echo "<div class = 'label-element3'>";
$counter = 0;
}
include ('inc/assign-names-to-array-values.php');
echo "<div class = 'inner-label'>";
echo $name . " <br>" . $address . "<br> " . $city . ", " . $state . " " . $zip ;
echo "</div>";
echo "</div>";
$allcounter++;
if ($allcounter === 30) {
echo "</div><div class = 'pdf-page-break'>";
$allcounter = 0;
}
}
echo "</div>"; style.css ▾
.label-page {
padding: 70px 20px 0 20px ;
}
.label-element1, .label-element2, .label-element3 {
width: 35%;
display: inline-block;
vertical-align: top;
line-height: 120%;
box-sizing: border-box;
font-size: 13px;
max-width: 100%;
margin-bottom: 16px;
text-align: center;
font-family: 'Arial', sans-serif;
height: 80px;
}
.label-element2 {
width: 33%;
}
.label-element3 {
width: 28%;
}
.inner-label, .inner-label-return {
width: 210px;
text-align: left;
padding: 0 20px;
}
.inner-label-return {
text-align: center;
}
.label-page.return {
text-align: center;
}
footer {
display: block;
}
.formpage {
text-align: center;
font-family: 'Arial';
color: #555;
}
form {
padding-top: 60px;
}
label,input, textarea {
font-family: 'Arial', sans-serif;
}
textarea{
width: 400px;
}
label {
font-size: 18px;
font-weight: bold;
}
@media print {
.pdf-page-break {
page-break-after: always;
padding: 70px 20px 0 20px ;
}
.pdf-page-break.return {
text-align: center;
}
}