<?php
// Include database connection
include_once("include/header.php");
// Check if payment type is provided
if(isset($_GET['payment_type'])) {
// Get the payment type from the request
$payment_type = $_GET['payment_type'];
// Query to fetch payment details based on payment type
$query = "SELECT payment_link, name FROM `wallet` WHERE payment_type = '$payment_type' LIMIT 1";
// Execute the query
$result = mysqli_query($conn, $query);
// Check if there are any results
if(mysqli_num_rows($result) > 0) {
// Fetch the details
$row = mysqli_fetch_assoc($result);
// Prepare the response data
$response = array(
'payment_link' => $row['payment_link'],
'name' => $row['name']
);
// Send JSON response
echo json_encode($response);
} else {
// No matching payment details found
echo json_encode(array('error' => 'Payment details not found'));
}
} else {
// Payment type not provided
echo json_encode(array('error' => 'Payment type not provided'));
}
?>