-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateUser.php
More file actions
35 lines (31 loc) · 955 Bytes
/
createUser.php
File metadata and controls
35 lines (31 loc) · 955 Bytes
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
<?php
include_once("./database.php");
$database = new Database();
$user = new User($database);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["user_name"];
$email = $_POST["user_email"];
if ($user->createUsers($name, $email)) {
header("Location: index.php");
} else {
echo "Sorry, couldn't create user.";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="form__container">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"])?>" method="post">
<input type="text" name="user_name" placeholder="Enter your name..."><br>
<input type="text" name="user_email" placeholder="Enter your email..."><br>
<input type="submit" name="submit" placeholder="Submit">
</form>
</div>
</body>
</html>