Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $name = null;
- $email = null;
- $username = null;
- $pwd = null;
- $pwd2 = null;
- if (!empty($_POST)){
- ob_end_clean();
- $name = htmlspecialchars($_POST["name"]);
- $email = htmlspecialchars($_POST["email"]);
- $username = htmlspecialchars($_POST["username"]);
- $pwd = htmlspecialchars($_POST["pwd"]);
- $pwd2 = htmlspecialchars($_POST["pwd2"]);
- if ($pwd == $pwd2){
- echo "
- <!DOCTYPE html>
- <html>
- <head>
- <title>Week 5 Assignment</title>
- <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
- </head>
- <body>
- <p>Welcome $name ! Please review the following information that you submitted:</p>
- <p>You entered $email as your email.</p>
- <p>You entered $username as your username.</p>
- <p>You entered $pwd as your password.</p>
- </body>
- </html>";
- }
- else {
- echo "
- <!DOCTYPE html>
- <html>
- <head>
- <title>Week 5 Assignment</title>
- <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
- </head>
- <body>
- <form action="; echo htmlspecialchars($_SERVER["PHP_SELF"]); echo" method="post">
- <p> Name: <input type="text" name="name" value=$name></p>
- <p>Email: <input type="email" name="email" value=$email></p>
- <p>Username: <input type="text" name="username" value=$username></p>
- <p>Password: <input type="password" name="pwd" minlength = 4></p>
- <p>Retype Password: <input type="password" name="pwd2"></p>
- <input type="submit">
- </form>
- <p>Passwords did not match</p>
- </body>
- </html>";
- }
- }
- elseif (empty($_POST)){
- echo "
- <!DOCTYPE html>
- <html>
- <head>
- <title>Week 5 Assignment</title>
- <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
- </head>
- <body>
- <form action="; echo htmlspecialchars($_SERVER["PHP_SELF"]); echo" method="post">
- <p> Name: <input type="text" name="name"></p>
- <p>Email: <input type="email" name="email"></p>
- <p>Username: <input type="text" name="username"></p>
- <p>Password: <input type="password" name="pwd" minlength = 4></p>
- <p>Retype Password: <input type="password" name="pwd2"></p>
- <input type="submit">
- </form>
- </body>
- </html>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement