Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Welcome!</title>
- <meta charset="utf-8">
- </head>
- <body>
- <?php
- if (isset($_POST['username']) and $_POST['username']) {
- $title = null;
- if (isset($_POST['gender']) and $_POST['gender']) {
- switch ($_POST['gender']) {
- case 'male':
- $title = 'Mr.';
- break;
- case 'female':
- $title = 'Ms.';
- break;
- default:
- $title = null;
- break;
- }
- }
- echo "<h1>Welcome, " . $title . " " . $_POST['username'] . "!</h1>";
- if (isset($_POST['email']) and $_POST['email']) {
- echo "<h2>We may contact you via email address ";
- echo $_POST['email'] . "</h2>";
- }
- if (isset($_POST['color']) and $_POST['color']) {
- echo "<h2>We're glad to know that your favorite color is ";
- echo "<span style='color:" . $_POST['color'] . "'>"
- . strtoupper($_POST['color']) . "</span><h2>";
- }
- echo "<p><a href='form_hello.php'>Go back to form</a></p>";
- } else {
- echo "<h2>What's your name again?</h2>";
- echo "<p><a href='form_hello.php'>Let us know.</a></p>";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement