Guest User

Untitled

a guest
Apr 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1.   <?php
  2.  
  3.   // ^X?[\d]{5}[ ]*\-[ ]*[\d]{2}$ ID
  4.   // ^[A-Z]{1}[\w]+([ ]+[\w]{2,})?$ Jmeno
  5.   // ^[\d]+[ ]+((KČ)|(kč)|(Kč)|(kČ))$
  6.  
  7.   if (isset($_GET["ID"])) $id = $_GET["ID"];
  8.   if (isset($_GET["Jmeno"])) $jmeno = $_GET["Jmeno"];
  9.   if (isset($_GET["Cena"])) $cena = $_GET["Cena"];
  10.  
  11.   if (preg_match("/^X?[\d]{5}[ ]*\-[ ]*[\d]{2}$/", $id) != 1)
  12.   {
  13.     echo "Spatne ID !";
  14.   }
  15.  
  16.   if (preg_match("/^[A-Z]{1}[\w]+([ ]+[\w]{2,})?$/", $jmeno) != 1)
  17.   {
  18.     echo "Spatne jmeno !";
  19.   }
  20.  
  21.   if (preg_match("/^[\d]+[ ]+((KČ)|(kč)|(Kč)|(kČ))$/", $cena) != 1)
  22.   {
  23.     echo "Spatna cena !";
  24.   }
  25.  
  26.   echo "<form method='get'>";
  27.  
  28.   echo "<table cellpadding='5'>";
  29.   echo "<tr><td>ID</td><td><input type='text' name='ID'></td></tr>";
  30.   echo "<tr><td>Jméno</td><td><input type='text' name='Jmeno'></td></tr>";
  31.   echo "<tr><td>Cena</td><td><input type='text' name='Cena'></td></tr>";
  32.   echo "</table>";
  33.  
  34.   echo "<input type='submit' value='Odeslat'>";
  35.  
  36.   echo "</form>";
  37.  
  38.   ?>
Add Comment
Please, Sign In to add comment