-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.php
More file actions
121 lines (93 loc) · 2.92 KB
/
form.php
File metadata and controls
121 lines (93 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>PHP Basic Form</title>
<!--Bootstrap Css-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
body {
margin: 0;
padding: 0;
font-family: candara;
background: #ecf0f1;
}
.reg-form {
margin: 50px auto;
border: 1px solid white;
padding: 30px;
color: black;
font-weight: bold;
box-shadow: 2px 1px 7px rgba(0, 0, 0,0.5);
background: white;
}
.reg-form hr{
border-top: 2px solid grey;;
font-weight: bold;
}
.login-form table {
margin-top: 30px;
}
.reg-form input {
padding: 6px 10px;
border: 1px solid grey;
}
</style>
</head>
<body>
<?php
$error = ['full_name' => '', 'user_name' => '', 'email' => '', 'pass' => ''];
$fullName = $userName = $email = $password = '';
if(isset($_POST['register'])){
$fullName = htmlspecialchars($_POST['fname']);
$userName = htmlspecialchars($_POST['uname']);
$email = htmlspecialchars($_POST['email']);
$password = htmlspecialchars($_POST['pass']);
if(empty($fullName)){
$error['full_name'] = "Please Enter Your Full Name";
}
if(empty($userName)){
$error['user_name'] = "Please Enter Your User Name";
}
if(empty($email)){
$error['email'] = "Please Enter Your Email Address";
}
if(empty($password)){
$error['pass'] = "Please Enter Your Password";
}
}
?>
<div class="container reg-form w-50 mt-5 c-dark">
<h2>Sign UP Now</h2>
<hr>
<form action="" method="POST">
<div class="form-group">
<label for="fname">Full Name</label>
<input type="text" id="fname" name="fname" class="form-control" value="<?=$fullName?>">
<span style="color: red;"><?php echo $error['full_name']; ?></span>
</div>
<div class="form-group">
<label for="uname">User Name</label>
<input type="text" id="uname" name="uname" class="form-control" value="<?=$userName?>">
<span style="color: red;"><?php echo $error['user_name']; ?></span>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="text" id="email" name="email" class="form-control" value="<?=$email?>">
<span style="color: red;"><?php echo $error['email']; ?></span>
</div>
<div class="form-group">
<label for="pass">Password</label>
<input type="password" id="pass" name="pass" class="form-control" value="<?=$password?>">
<span style="color: red;"><?php echo $error['pass']; ?></span>
</div>
<div class="form-group">
<input type="submit" value="Register Now" name="register" class="btn btn-primary">
</div>
</form>
<h4>If you are Existing User Please, <a target="_blank" href="login.php">Sign In</a> here</h4>
</div>
</body>
</html>