Tool Script for QR Code Generator

 Tool Script for QR Code Generator in html css java php

Tool Script for QR Code Generator

Index.html:

<!DOCTYPE html>
<html>
<head>
  <title>QR Code Generator</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f2f2f2;
      margin: 0;
      padding: 20px;
    }

    .container {
      max-width: 400px;
      margin: 0 auto;
      background-color: #fff;
      padding: 20px;
      border-radius: 5px;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    h1 {
      text-align: center;
    }

    label {
      display: block;
      margin-bottom: 10px;
      font-weight: bold;
    }

    .result {
      margin-top: 20px;
      text-align: center;
    }

    .btn {
      display: inline-block;
      background-color: #4CAF50;
      color: #fff;
      text-decoration: none;
      padding: 10px 20px;
      border-radius: 4px;
      cursor: pointer;
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>QR Code Generator</h1>
    <form action="generate.php" method="post">
      <label for="data">Data:</label>
      <input type="text" name="data" id="data" placeholder="Data" required>
      <button class="btn" type="submit">Generate</button>
    </form>
  </div>
</body>
</html>


Generate.php:

<!DOCTYPE html>
<html>
<head>
  <title>QR Code Generator</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f2f2f2;
      margin: 0;
      padding: 20px;
    }

    .container {
      max-width: 400px;
      margin: 0 auto;
      background-color: #fff;
      padding: 20px;
      border-radius: 5px;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    h1 {
      text-align: center;
    }

    .result {
      margin-top: 20px;
      text-align: center;
    }

    .qr-code {
      display: block;
      margin: 20px auto;
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>QR Code Generator</h1>
    <?php
      require 'phpqrcode/qrlib.php';

      $data = $_POST['data'];
      $filename = 'qrcodes/' . uniqid() . '.png';
      $errorCorrectionLevel = 'L'; // Error correction level (L, M, Q, H)
      $matrixPointSize = 5; // Matrix point size (1 to 10)

      QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize);

      echo "<div class='result'>Generated QR Code:</div>";
      echo "<img class='qr-code' src='" . $filename . "' alt='QR Code'>";
    ?>
  </div>
</body>
</html>

Post a Comment

0 Comments