<?php
session_start();

require("../includes/db_connect.php");

if ($_SERVER['REQUEST_METHOD'] === 'POST') {

    if ((!empty($_POST['payment_method'])) && (!empty($_POST['amount']))) {

        $amount = $_POST['amount'];
        $payment_method = $_POST['payment_method'];
        $withdraw_id = $_POST['withdraw_id'];

        if (is_numeric($amount)) {
            $_SESSION['charges_amount'] = $amount;
            $_SESSION['charges_payment_method'] = $payment_method;
            $_SESSION['withdraw_id'] = $withdraw_id;
            die("success");
        }else {
            die("Enter a valid amount!");
        }
    } else {
        die('An unexpected error occurred. Connection failed.');
    }
} else {
    die('An unexpected error occurred. Connection failed.');
}