-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
52 lines (36 loc) · 1.19 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
<?php
require('user-validator.php');
if (isset($_POST['submit'])) {
// validate entries
$validation = new UserValidator($_POST);
$errors = $validation->validateForm();
// option to sava data to a database
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Validation Class</title>
<link rel="stylesheet" href="public/css/main.css">
</head>
<body>
<div class="new-user">
<h2>Create new user</h2>
<form action="<?php echo $SERVER['PHP_SELF'] ?>" method="POST">
<label>Username:</label>
<input type="text" name="username" value="<?php echo htmlspecialchars($_POST['username']) ?? '' ?>">
<div class="error">
<?php echo $errors['username'] ?? '' ?>
</div>
<label>Email:</label>
<input type="text" name="email" value="<?php echo htmlspecialchars($_POST['email']) ?? '' ?>">
<div class="error">
<?php echo $errors['email'] ?? '' ?>
</div>
<input type="submit" value="submit" name="submit">
</form>
</div>
</body>
</html>