Hello everyone!!! So here is my problem…
When a user is making a donation in the Billing Information Name field and they enter a “middle initial” an error message of "Bill To Last Name is required. " appears and the transaction is declined. In the paypal.php file I have tried to edit the code so a middle initial is added to the first name but have been unsuccessful. What changes to the code do i need to make so a user can add a middle name or initial and the transaction will process. Here is the code currently that will only allow a First and Last name to be entered into the Name field.
Code in paypal.php file:
// donor info
$fullname = isset($_POST['gdlr-name']) ? strip_tags(trim($_POST['gdlr-name'])) : '';
$firstname = $fullname;
$lastname ='';
if($fullname)
{
$name = preg_split('/\s+/', $fullname);
if(count($name) == 2)
{
$firstname = $name[0];
$lastname = $name[1];
}
}
Thanks in advance!!!
Sam