Open phone number in shopping cart using php verification
P粉269847997
P粉269847997 2024-03-31 22:44:47
0
1
364

opencart 3

<div class="form-group ">
   <label class="col-sm-2 control-label" for="input-name"> another telephone</label>
   <div class="col-sm-10">
      <input type="text" name="another_telephone" value="{{another_telephone}}" class="form-control" placeholder="another telephone">
   </div>
</div>

I added a custom field "Another Phone" to the vendor store form. It accepts letters, numbers and symbols.

Question: I want to verify that the phone number in my field is valid.

Attachment: Text field > Another phone call

P粉269847997
P粉269847997

reply all(1)
P粉187677012

Maybe I didn't understand your question correctly, but if you need to change another alphabetical phone to alphanumeric mode 2(A,B,C) 3(D, E) ,F) 4(G,H,I) 5(J,K,L) 6(M,N,0) 7(P,Q,R,S) 8(T,U,V) 9(W ,X) ,Y,Z)You can try this:

$another_phone = 'holidays1';
$alias_array = array(
    '0' => ['0'],
    '1' => ['1'],
    '2' => ['A','B','C'],
    '3' => ['D','E','F'],
    '4' => ['G','H','I'],
    '5' => ['J','K','L'],
    '6' => ['M','N','O'],
    '7' => ['P','Q','R','S'],
    '8' => ['T','U','V'],
    '9' => ['W','X','Y','Z']);
    
$phone_in_letters = strtoupper($another_phone);
//creating an array
$phone_in_letters_array = str_split($phone_in_letters );

$phone_array = [];
foreach($phone_in_letters_array as $val) {
    foreach ($alias_array as $key => $letters) {
        if (in_array($val, $letters)) {
            $phone_array[] = $key;
        }
    }
}

print_r(implode($phone_array));
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!