示例#1
0
<?php

if (is_ajax()) {
    if (isset($_POST["action"]) && !empty($_POST["action"])) {
        //Checks if action value exists
        $action = $_POST["action"];
        switch ($action) {
            //Switch case for value of action
            case "saveorder":
                saveOrder();
                break;
            case "register_order":
                register_order();
                break;
        }
    }
}
//Function to check if the request is an AJAX request
function is_ajax()
{
    return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
}
function register_order()
{
    include '../config.php';
    $registration_data = $_POST['registration_data'];
    $next_id_sql = "SELECT Auto_increment FROM information_schema.tables WHERE table_name='tbluser'";
    $query = mysqli_query($conn, $next_id_sql);
    $result = mysqli_fetch_row($query);
    $user_id = $result[0];
    $usertypeid = 2;
示例#2
0
        $errors[] = 'Amount must be a integer value';
    }
    if (!is_numeric($_POST['fee'])) {
        $errors[] = 'Fee must be a integer value';
    }
    if (!is_numeric($_POST['rate'])) {
        $errors[] = 'Rate must be a integer value';
    }
}
if (empty($errors) === false) {
    echo output_errors($errors);
}
if (!empty($_POST) && empty($errors)) {
    if (isset($_POST['amount'], $_POST['fee'], $_POST['rate'])) {
        $register_data = array('benef_id' => $_GET['id'], 'amount' => $_POST['amount'], 'rate' => $_POST['rate'], 'fee' => $_POST['fee'], 'amount_send' => $_POST['amt'], 'total' => $_POST['total']);
        if (register_order($register_data)) {
            header('Location: beneficiary.php');
            // redirect
        } else {
            header('Location: add_beneficiary.php');
        }
        exit;
    }
}
?>
<table border ="1">
        <thead>
                <tr>
                        <th>First name</th>
                        <th>Last name</th>
                        <th>Bank</th>