-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd.php
More file actions
68 lines (52 loc) · 1.28 KB
/
add.php
File metadata and controls
68 lines (52 loc) · 1.28 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
<!DOCTYPE html>
<html>
<head>
<title>Basic CRUD</title>
</head>
<body>
<?php
require 'config.php'; // include file connect to db
include 'menu.php'; //include menu list from menu.php, you may edit accordingly
if(empty(trim(isset($_POST["namaSendiri"])))){
echo "<br><br><br>";
} else
{
$namaSendiri = trim($_POST['namaSendiri']);
$namaBapa= trim($_POST['namaBapa']);
//SQL, change into your table name and column
$sql = "INSERT INTO pelanggan (namaSendiri, namaBapa)
VALUES ('$namaSendiri','$namaBapa')";
if ($conn->query($sql) === TRUE) {
echo "<br><br>New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
?>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<table>
<tr>
<td>
<label for="namaSendiri">Nama:</label>
<input type="text" name="namaSendiri" required>
</td>
</tr>
<tr>
<td>
<label for="namaBapa">Nama Family:</label>
<input type="text" name="namaBapa" required>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
<?php
include 'footer.php';
?>
</body>
</html>