<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

session_start();
include('con.php');
include('header.php');

if (!isset($_SESSION['phone'])) {
    header("Location: login.php");
    exit;
}

$phone = $_SESSION['phone'];

$user_q = mysqli_query($ahk_conn, "SELECT * FROM users WHERE phone='$phone'");
$udata  = mysqli_fetch_assoc($user_q);
$user_id = $udata['id'];
$errorMsg   = null;
$successMsg = null;


?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>UPI Wallet TopUp</title>

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">

<style>
body { background:#f3f7fd; font-family:Poppins,sans-serif }
.form-card {
    background:#fff;
    border-radius:15px;
    padding:25px;
    box-shadow:0 8px 25px rgba(0,0,0,0.1)
}
.page-title { font-weight:700; color:#0d6efd }
</style>
</head>

<body>

<div class="container-fluid px-4 py-4">
<div class="row justify-content-center">
<div class="col-lg-6">

<div class="form-card">
<h4 class="page-title mb-3">UPI PG Gateway – Wallet Top-Up</h4>

<form method="POST" action="akpaytm/txnProcess.php">

    <input type="hidden" name="phone" value="<?= htmlspecialchars($udata['phone']) ?>">
    <input type="hidden" name="id" value="<?= (int)$udata['id'] ?>">

    <div class="mb-3">
        <label class="form-label">Amount (₹)</label>
        <input type="number"
               class="form-control border-primary"
               name="amount"
               placeholder="Minimum ₹50"
               min="50"
               max="10000"
               required>
    </div>

    <button type="submit" name="akupi" class="btn btn-primary w-100">
        Add Money
    </button>

</form>
</div>

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

<?php include('footer.php'); ?>
</body>
</html>
