Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Валидатор за час</title>
- </head>
- <body bgcolor="#99ffcc">
- <h2>Валидатор на час</h1>
- <form action="#" method="post">
- <label for="time">Час: </label>
- <input type="text" name="time">
- <input type="submit" name="validate" value="Валидирай">
- </form>
- <?php
- if (isset($_POST["validate"])){
- $time = $_POST["time"];
- $regex = "/^(([0-1][0-9])|(2[0-3]))(:[0-5][0-9]){2}$/";
- if (preg_match($regex, $time)){
- echo "<p>".$time." is valid!</p>";
- } else {
- echo "<p>NOT VALID</p>";
- }
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement