PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
  Classes of Ferry Bouwhuis  >  PHP Barcode Checker (EAN/JAN/UPC/GTIN)  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: You can test if a bar code is vallid
Class: PHP Barcode Checker (EAN/JAN/UPC/GTIN)
Detect type and check EAN and UPC barcodes
Author: By
Last change:
Date: 5 years ago
Size: 1,124 bytes
 

 

Contents

Class file image Download
<?php
include_once('clsLibGTIN.php');
if(!isset(
$_GET['barcode']))
{
    echo
"0843163050105<br />";
    echo
'clsLibGTIN::GTINCheck(\'0843163050105\', 1) returns: <stong>' . clsLibGTIN::GTINCheck('0843163050105', 1) . '</strong><br />';
    echo
'clsLibGTIN::GTINCheck(\'0843163050105\') returns: <stong>' . clsLibGTIN::GTINCheck('0843163050105') . '</strong><br />';
}else{
    echo
'<p>Barcode check for: <strong>' . (string)$_GET['barcode'] . '</strong><br />';
    echo
'This is a ' . (clsLibGTIN::GTINCheck($_GET['barcode']) ? '<span style="color: green">correct</span>' : '<span style="color: red">incorrect</span>'). ' barcode<br />
        '
.(clsLibGTIN::GTINCheck($_GET['barcode']) ? 'It is a: <strong>' . clsLibGTIN::GTINCheck($_GET['barcode'], false, 1) . '</strong> code (' . clsLibGTIN::GTINCheck($_GET['barcode']) . ')<br />It can be displayed as GTIN-14: ' . clsLibGTIN::GTINCheck($_GET['barcode'], true) : '').'</p>';
}
?>
<p>Add barcode and check the result:
<form name="input" action="example.php" method="get">
Barcode: <input type="text" name="barcode">
<input type="submit" value="Submit">
</form>
</p>