function test_input($data)
{
    $data = trim($data);
    // remove whitespaces and predefined chars(&lt->'<') - both ends
    $data = htmlspecialchars($data);
    // converts predefined chars and process the data and then returns.
    return $data;
}
if ($_POST && $firstnameError == "" && $lastnameError == "" && $emailError == "" && $phoneError == "") {
    require_once 'PassportPayments.php';
    $appId = "37Z8ZDAZE8N";
    $appSecret = "b2578c560673697eb49834b05a70aa1a";
    $publicKey = "37XI8CVAQSK";
    $endPoint = 'https://sandbox.passportpayments.com';
    $pp = new PassportPayments($appId, $appSecret, $publicKey, $endPoint);
    $customerAdd = $pp->saveCustomer($firstname, $lastname, $email, $phone, "");
    if ($customerAdd->status != 200) {
        echo "message: " . $customerAdd->message . "<br>";
    } else {
        header('Location: home.php');
    }
} else {
    ?>
<!DOCTYPE HTML>
<html>
<body>

<h1>Add a Customer</h1>

<form method="post" action="<?php 
    echo htmlspecialchars($_SERVER["PHP_SELF"]);