-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
51 lines (41 loc) · 1.3 KB
/
insert.php
File metadata and controls
51 lines (41 loc) · 1.3 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
<!DOCTYPE html>
<html>
<head>
<title>Insert</title>
<meta http-equiv="refresh" content="2;url=/" />
</head>
<body>
<center>
<?php
$conn = mysqli_connect("localhost", "root", "", "panel");
// Check connection
if($conn === false){
die("ERROR: Could not connect. "
. mysqli_connect_error());
}
$id = '';
$first_name = $_REQUEST['first_name'];
$last_name = $_REQUEST['last_name'];
$phone = $_REQUEST['phone'];
$email = $_REQUEST['email'];
$date_time = $_REQUEST['date_time'];
$descr = $_REQUEST['descr'];
// Performing insert query execution
$sql = "INSERT INTO `orders` VALUES ('$id','$first_name','$last_name','$phone','$email','$date_time','$descr')";
$sql2 = "INSERT INTO `users` VALUES ('$id','$first_name','$last_name','$phone','$email')";
if(mysqli_query($conn, $sql) && mysqli_query($conn, $sql2)){
echo "<h3>data stored in a database successfully."
. " Opdracht voltooid!"
. " u wordt terug gestuurd :)</h3>";
echo nl2br("\n$id\n$first_name\n $last_name\n "
. "$phone\n $email\n $date_time\n $descr");
} else{
echo "<h3>u wordt terug gestuurd :)</h3>";
// echo "ERROR: oops! $sql. " . mysqli_error($conn);
}
// Close connection
mysqli_close($conn);
?>
</center>
</body>
</html>