63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
<?php
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
//$qtt = $_POST["qtt"];
|
|
$qtt = empty($_POST['qtt']) ? 1 : $_POST['qtt'];
|
|
$texte = $_POST["texte"];
|
|
$barcode = empty($_POST['barcode']) ? "y" : $_POST['barcode'];
|
|
|
|
|
|
// Commande pour exécuter le script Python avec les données du formulaire
|
|
$command = "python3 etiquettes-custom-serial.py --qtt $qtt --texte \"$texte\" --bc $barcode";
|
|
|
|
|
|
//echo "$command <br>";
|
|
|
|
// Exécutez la commande
|
|
$output = shell_exec($command);
|
|
|
|
// Affichez la sortie du script Python
|
|
//echo "Résultat du script Python :<br>";
|
|
//echo nl2br($output); // Affiche les sauts de ligne
|
|
}
|
|
?>
|
|
|
|
|
|
|
|
|
|
<!doctype html>
|
|
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title>Impression</title>
|
|
|
|
<link rel="icon" href="favicon.png">
|
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
|
|
|
<link rel="stylesheet" href="css/bootstrap.css">
|
|
|
|
</head>
|
|
|
|
<body class="bg-secondary">
|
|
<div class="d-flex justify-content-center align-items-center" style="height: 100vh;">
|
|
<div class="m-4 p-3 rounded border bg-light">
|
|
<h1>Les étiquettes sont imprimées</h1>
|
|
|
|
<div class="alert alert-success">
|
|
<?php
|
|
echo nl2br($output); // Affiche les sauts de ligne
|
|
?>
|
|
</div>
|
|
|
|
|
|
<div class="d-grid">
|
|
<a href="custom.html" class="btn btn-primary btn-block">retour</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|