Home / Admin / verify
Duplicate Snippet

Embed Snippet on Your Site

verify

Code Preview
php
<?php
	<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Employee ID Verification</title>
  <!-- Optional basic styling for clarity -->
  <style>
    body {
      font-family: system-ui, sans-serif;
      max-width: 28rem;
      margin: 2rem auto;
      padding: 0 1rem;
      line-height: 1.5;
    }
    form {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-top: 1rem;
    }
    input[type="text"] {
      flex: 1 1 12rem;
      padding: 0.4rem 0.6rem;
      border: 1px solid #ccc;
      border-radius: 4px;
    }
    button[type="submit"] {
      padding: 0.45rem 1rem;
      border: none;
      background: #0073e6;
      color: #fff;
      border-radius: 4px;
      cursor: pointer;
    }
    button[type="submit"]:hover {
      background: #005bb5;
    }
  </style>
</head>
<body>
  <main>
    <section aria-labelledby="page-title">
      <h1 id="page-title">Employee ID Verification</h1>
      <form id="verify-form" aria-label="Employee ID Verification Form">
        <label for="empId" class="sr-only">Employee ID</label>
        <input
          type="text"
          id="empId"
          name="empId"
          placeholder="e.g. EMP123"
          required
          autocomplete="off"
        />
        <button type="submit">Verify</button>
      </form>
      <output
        id="result"
        aria-live="polite"
        style="display:block; margin-top: 1rem; font-weight: 600;"
      ></output>
    </section>
  </main>
  <script>
    /* List of valid employee IDs */
    const validIDs = ["EMP001", "EMP002", "EMP100", "EMP999"];
    /* Handle form submission */
    document.getElementById("verify-form").addEventListener("submit", function (e) {
      e.preventDefault(); // Prevent page reload
      verifyID();
    });
    function verifyID() {
      const input = document.getElementById("empId").value.trim().toUpperCase();
      const result = document.getElementById("result");
      if (!input) {
        result.textContent = "Please enter an Employee ID.";
        result.style.color = "orange";
        return;
      }
      if (validIDs.includes(input)) {
        result.textContent = "✅ ID is valid!";
        result.style.color = "green";
      } else {
        result.textContent = "❌ Invalid ID.";
        result.style.color = "red";
      }
    }
  </script>
</body>
</html>

Comments

Add a Comment