<?php
require_once __DIR__ . '/../db_connect.php';
session_start();

if ($_SERVER['REQUEST_METHOD']==='POST') {
    $fullname = $_POST['fullname'];
    $email    = $_POST['email'];
    $phone    = $_POST['phone'];
    $company  = $_POST['company'];

    $stmt = $conn_rbe->prepare("INSERT INTO agent_applications
      (user_id, fullname, email, phone, company, status, created_at, updated_at)
      VALUES (0,?,?,?,?, 'pending', NOW(), NOW())");
    $stmt->execute([$fullname,$email,$phone,$company]);

    echo "Application submitted. RBE will review.";
    exit;
}
?>
<form method="post">
  <label>Full Name <input name="fullname" required></label>
  <label>Email <input type="email" name="email" required></label>
  <label>Phone <input name="phone" required></label>
  <label>Company <input name="company"></label>
  <button type="submit">Apply</button>
</form>
