Advertisement
vencinachev

GSM validation

Mar 10th, 2021
934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.   <title>GSM</title>
  5. </head>
  6. <body bgcolor="#99ffcc">
  7.    <h2>GSM номер валидатор</h1>
  8.    <form action="#" method="post">
  9.     <label for="gsm">GSM: </label>
  10.     <input type="text" name="gsm">
  11.     <input type="submit" name="validate" value="Валидирай">
  12.    </form>
  13.    <?php
  14.     if (isset($_POST["validate"])){
  15.         $gsm = $_POST["gsm"];
  16.         $regexGsm = "/^(0|(\+359))8[7-9][0-9]{7}$/";
  17.         if (preg_match($regexGsm, $gsm)){
  18.             echo "<p>".$gsm." е валиден GSM номер</p>";
  19.         } else {
  20.             echo "<p>Невалиден GSM номер</p>";
  21.         }
  22.     }
  23.    ?>
  24. </body>
  25. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement