Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- .error {
- color: red;
- }
- </style>
- <title>Register</title>
- </head>
- <body>
- <form action="#" method="POST">
- <h1 id="Signup">Sign Up</h1>
- <input type="text" name="Username" placeholder="Please Enter a Username">
- <span class="error"><? echo $errorusername;?></span>
- <br>
- <input type="password" name="Password" placeholder="Please Enter a Password">
- <span class="error"><? echo $errorpass;?></span>
- <br>
- <input type="Submit" id ="Submit">
- </form>
- </body>
- </html>
- <?
- $errorpass = "";
- $errorusername ="";
- if(isset($_POST['Submit'])) {
- if(empty($_POST['Username'])) {
- $errorusername = "name is required";
- } else {
- $Username = $_POST['Username'];
- if (!preg_match("/^[a-zA-Z ]*$/", $Username)) {
- $errorusername ="Only numbers allowed";
- }
- }
- if(empty($_POST['password'])) {
- $errorusername = " A password is required";
- } else {
- $password = $_POST['password'];
- if (!preg_match("/^[a-zA-Z ]*$/", $password)) {
- $errorpass = "Need to contain numbers and symbols";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement