-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
144 lines (118 loc) · 7.91 KB
/
index.php
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
session_start() ;
require_once "base.php" ;
require_once "function.php" ;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Validation</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<body class="bg-dark">
<div class="container">
<div class="row">
<div class="col-12 col-md-4 mx-auto">
<div class="my-5">
<div class="card">
<div class="card-body">
<h3 class="text-uppercase">Register Form</h3>
<hr>
<?php
if(isset($_POST['reg'])){
register() ;
}
?>
<form action="" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="name" class="text-primary font-weight-bold">Your Name</label>
<input type="text" name="name" id="name" class="form-control" value="<?php echo old('name') ; ?>" placeholder="Your name">
<?php if(getError('name')){ ?>
<small class="text-danger font-weight-bold"><?php echo getError('name') ; ?></small>
<?php } ?>
</div>
<div class="form-group">
<label for="email" class="text-primary font-weight-bold">Your Email</label>
<input type="text" name="email" id="email" class="form-control" value="<?php echo old('email') ; ?>" placeholder="Your Email">
<?php if(getError('email')){ ?>
<small class="text-danger font-weight-bold"><?php echo getError('email') ; ?></small>
<?php } ?>
</div>
<div class="form-group">
<label for="phone" class="text-primary font-weight-bold">Your Phone</label>
<input type="text" name="phone" id="phone" class="form-control" value="<?php echo old('phone') ; ?>" placeholder="Your Phone">
<?php if(getError('phone')){ ?>
<small class="text-danger font-weight-bold"><?php echo getError('phone') ; ?></small>
<?php } ?>
</div>
<div class="form-group">
<label for="address" class="text-primary font-weight-bold">Your Address</label>
<textarea type="text" name="address" id="address" class="form-control" placeholder="Your Address"><?php echo old('address') ; ?></textarea>
<?php if(getError('address')){ ?>
<small class="text-danger font-weight-bold"><?php echo getError('address') ; ?></small>
<?php } ?>
</div>
<div class="form-group">
<label for="" class="text-primary font-weight-bold">Your Gender</label>
<div class="border rounded p-2 text-center">
<?php foreach($genderArr as $g){ ?>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="<?php echo $g ; ?>_id" name="gender" <?php echo (old('gender') == $g ? 'checked' : '') ?> class="custom-control-input" value="<?php echo $g ; ?>">
<label class="custom-control-label text-capitalize" for="<?php echo $g ; ?>_id"><?php echo $g ; ?></label>
</div>
<?php } ?>
</div>
<?php if(getError('gender')){ ?>
<small class="text-danger font-weight-bold"><?php echo getError('gender') ; ?></small>
<?php } ?>
</div>
<div class="form-group">
<label for="" class="text-primary font-weight-bold">Your Skill</label>
<div class="border rounded p-2 text-center">
<?php foreach($skillArr as $s){ ?>
<div class="custom-control custom-checkbox custom-control-inline">
<input type="checkbox" name="skill[]" class="custom-control-input"
value="<?php echo $s ; ?>"
id="<?php echo $s ; ?>_skill"
<?php
if(old('skill')){
echo in_array($s, old('skill')) ? 'checked' : '' ;
}
?>
>
<label class="custom-control-label" for="<?php echo $s ; ?>_skill"><?php echo $s ; ?></label>
</div>
<?php } ?>
</div>
<?php if(getError('skill')){ ?>
<small class="text-danger font-weight-bold"><?php echo getError('skill') ; ?></small>
<?php } ?>
</div>
<div class="form-group">
<label for="upload" class="text-primary font-weight-bold">Your Photo</label>
<input type="file" name="upload" id="upload" class="form-control p-1" value="<?php echo old('upload') ; ?>" >
<?php if(getError('upload')){ ?>
<small class="text-danger font-weight-bold"><?php echo getError('upload') ; ?></small>
<?php } ?>
</div>
<hr>
<div class="form-row justify-content-between align-items-center">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="customSwitch" checked required>
<label class="custom-control-label" for="customSwitch">All Correct</label>
</div>
<button class="btn btn-primary" name="reg">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php clearError() ; ?>
</body>
</html>