PHP code to verify the number in the list
function custom_zip_validation( $result, $value, $form, $field ) {
if ( $result['is_valid'] ) {
$acceptable_zips = array(
'AL', 'B', 'BD', 'BH', 'BN', 'BR', 'CB', 'CH', 'CM', 'CO', 'CR', 'CV', 'DA', 'DE', 'DN', 'DY', 'E', 'EC', 'EN', 'GU', 'HA', 'IG', 'IP', 'L', 'LE', 'LN', 'LU', 'M', 'ME', 'MK', 'N', 'NG', 'NN', 'NR', 'NW', 'PE', 'PO', 'RG', 'RM', 'S', 'SE', 'SG', 'SK', 'SL', 'SM', 'SO', 'SS', 'ST', 'SW', 'TN', 'TWUB', 'W', 'WWD', 'WW', 'FW', 'RW', 'WW'
and the
$zip_value = rgar( $value, $field->id .“5” ;
$zip_value = preg_replace('/[0-9]+/', ', $zip_value);
If ( if )in_array( $zip_value, $acceptable_zips ) {
$result ['is_valid'] = false
$result['message'] = 'Wrong postal code.‘;The
The
Return to $result
The
The same code is needed, for example, only to verify the numbers and issue the error if the entered number is on a specific list.For example:
Listings: "12380 - 13380", "58800 - 59800", "32500 - 33500"
I enter the mail index: LT58842 - it is on the second list, it must issue an error.
Client's review of cooperation with Mykola P.
PHP code to verify the number in the listGreat, the executive decided the bug, very much thank you for solving the problem. I recommend everyone to cooperate 🙂
Freelancer's review of cooperation with Justas Skarzinskas
PHP code to verify the number in the listThis is a very simple problem, the solution I, in my own way, have complicated.
But the customer indicated that it was to be cut off, and came to a normal result.
I recommend cooperation.
Current freelance projects in the category PHP
Modules for a website on Laravel
90 USD
Delivery and payment module for the site https://novabook.top/ (Botble CMS / Laravel) Add convenient delivery and payment methods (including installment plans) in the checkout, similar in style and convenience to the mirson ua site.Delivery (mandatory) Nova Poshta Branch… Javascript and Typescript, PHP ∙ 8 hours 59 minutes back ∙ 18 proposals |
Integration needed: KeyCRM → Cash Register KashalotIt is necessary to set up integration between KeyCRM and the Cash Register Kahalot. When placing an order in KeyCRM, the data must be automatically transmitted to Kahalot: • order information • products, nomenclature • prices • quantity More details in private. Content Management Systems, PHP ∙ 2 days 8 hours back ∙ 28 proposals |
Development of 2 SEO-oriented websites for selling spare parts (ATVs and special equipment)Development of Two Specialized Websites for Selling Spare PartsGeneral Information It is necessary to develop two specialized websites: Spare parts for ATVs, UTVs, SSVs, and other similar equipment. Spare parts for special equipment. Existing company website:… PHP, Web Programming ∙ 4 days 15 hours back ∙ 77 proposals |
Development of a WordPress website
23 USD
We are looking for a contractor to develop a custom website on WordPress for a jewelry store. The first stage will be a consultation. Content Management Systems, PHP ∙ 7 days 7 hours back ∙ 75 proposals |
Parser expireddomains.net
112 USD
A parser is needed for expireddomains.net. You need to log in to the site first; the problem is that it blocks the IP when trying to parse data. You need to parse thematic domains based on a list of keywords. If you are not confident in your abilities, please do not write. PHP, Web Programming ∙ 9 days 15 hours back ∙ 53 proposals |
