Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>PHP Form Handling</title>
- </head>
- <body>
- <form action="index.php" method="POST">
- <input type="text" name="username"/>
- <input type="submit" value="Send"/>
- </form>
- </body>
- </html>
- <?php
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $input = $_POST['username'];
- if (is_numeric($input)) {
- if ($input < 18 || $input > 90) {
- echo 'cannot vote';
- } else {
- echo 'can vote';
- }
- } else if (empty($input)) {
- echo 'empty input';
- } else {
- echo 'invalid input: ', $input;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement