-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd.php
More file actions
80 lines (74 loc) · 2.79 KB
/
Copy pathadd.php
File metadata and controls
80 lines (74 loc) · 2.79 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
<?php
session_start();
// Suruh page login first open
if( !isset($_SESSION["login"])){
header("Location: login.php");
exit;
}
require 'functions.php';
// Check button submit ditekan belum lagi
if (isset($_POST["submit"])) {
// Check if data has been added successfully
if (add($_POST) > 0) {
echo"
<script>
alert('Successfull added');
document.location.href='index.php'
</script>
";
} else {
$errorMessage = "Failed to add data";
$errorMessage .= "<br>" . mysqli_error($conn); // Display any errors
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="css/add.css">
<title>Add Student</title>
</head>
<body class="bg-light">
<video src="vd/ocean.mp4" autoplay loop muted playsinline></video>
<div class="container">
<form action="" method="post" enctype="multipart/form-data">
<h1 class="fs-2">Add Student Data</h1>
<div class="form-group">
<label for="nrp">ID Number:</label>
<input type="text" name="nrp" id="nrp" required>
</div>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" name="name" id="name" required>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" name="email" id="email" required>
</div>
<div class="form-group">
<label for="jurusan">Course:</label>
<input type="text" name="jurusan" id="jurusan" required>
</div>
<div class="form-group">
<label for="gambar">Photo:</label>
<input type="file" name="gambar" id="gambar">
</div>
<br>
<button type="submit" name="submit" class="btn btn-outline-primary">Add Data</button>
<div class="text-center mt-3">
<?php
// Display error message if ada problem
echo '<div class="text-danger">' . $errorMessage . '</div>';
?>
</div>
<div class="text-center mt-3">
<a href="index.php">Back</a>
</div>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
</body>
</html>