-
Notifications
You must be signed in to change notification settings - Fork 0
/
secNewCust.php
54 lines (51 loc) · 1.35 KB
/
secNewCust.php
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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
<title>Secretery's new Customer Registration Page</title>
</head>
<body>
<?php
session_start();
if(!isset($_SESSION["username"]))
header("Location: login.html");
include "config.php";
$conn -> select_db("heroku_ed39a20fb4d6fd8");
$fullname = $_POST["fullname"];
$phone = $_POST["phone"];
$age = $_POST["age"];
if(!empty($fullname) && !empty($phone) && !empty($age)){
$sql = "INSERT INTO Customer(full_name, phone_number, age)
VALUES ('$fullname', '$phone', '$age')";
if (mysqli_query($conn, $sql)){
echo "New record created successfully. <br>Redirecting to Secretery's new Customer Registration Page.";
?>
<script>
setTimeout(function() {
window.location.href="secretaryNewCust.php";
}, 3000);
</script>
<?php
}else {
echo mysqli_error($conn);
?>
<script>
setTimeout(function() {
window.location.href="secretaryNewCust.php";
}, 3000);
</script>
<?php
}
} else{
echo "Please fill all fields. <br>Redirecting to Secretery's new Customer Registration Page.";
?>
<script>
setTimeout(function() {
window.location.href="secretaryNewCust.php";
}, 3000);
</script>
<?php
}
?>
</body>
</html>