I'm a newbie in PHP, I use this PHP code that works like a charm. It's a custom form that sends to Woocommerce different fields. I want to add a "preg_match" check for each of those fields so the user can only enter:
$address = array(
'first_name' => $first_name,
'last_name' => $last_name,
'company' => '',
'email' => $email,
'phone' => $phone,
'address_1' => $street,
'city' => $city,
'state' => '',
'postcode' => $postcode,
'country' => $country,
);
In the telephone field: numbers, "+", spaces; (22 burns absolute) In the postcode field: postcodes are contained in a custom post type "Structures" with their titles as values. Just those qualities. How would I do that?
pre_match
could help but I can't find examples"$_SESSION
doesn't work on a lot of WordPress hosts, and has security issues that require extra steps to be taken. It's much easier and simpler to use cookies instead