-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_user.php
More file actions
56 lines (49 loc) · 2.04 KB
/
new_user.php
File metadata and controls
56 lines (49 loc) · 2.04 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
<?php
include('partials/navBar.php');
?>
<section class="transfer-money" id="transfer-money">
<h1 class="transfer-money-heading heading">Create new <span>User</span></h1>
<p>
<span>
<?php
if (isset($_SESSION['add_user'])){ //add session message
echo $_SESSION['add_user']; //display session message
unset($_SESSION['add_user']); //removing the session
}
?>
</span>
</p>
<div class="transfer-money-row">
<form action="" id="transfer-money-form" method="POST" enctype="multipart/form-data">
<input type="text" class="box" id="full_name" name="full_name" placeholder="Enter your full name" required>
<input type="text" class="box" id="email" name="email" placeholder="Enter your email id" required>
<input type="password" class="box" id="password" name="password" placeholder="Create a password" required>
<input type="number" class="box" name="amount" placeholder="Enter amount" id="amt" required>
<button type="submit" class="btn submit" name="submit">Create new user <i class="fas fa-paper-plane"></i></button>
</form>
</div>
</section>
<?php
if(isset($_POST['submit'])){
$full_name = $_POST['full_name'];
$email = $_POST['email'];
$password = $_POST['password'];
$amount = $_POST['amount'];
$sql = "INSERT INTO tbl_users SET
name = '$full_name',
email = '$email',
password = '$password',
balance = '$amount'";
$res = mysqli_query($conn, $sql);
if($res == TRUE){
$_SESSION['add_user'] = "User added successfully!!";
echo("<script>location.href = '".SITEURL."users.php';</script>");
}else{
$_SESSION['add_user'] = "Something went wrong!";
echo("<script>location.href = '".SITEURL."new_user.php';</script>");
}
}
?>
<?php
include('partials/footer.php')
?>