-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddClient.php
More file actions
executable file
·138 lines (99 loc) · 4.44 KB
/
addClient.php
File metadata and controls
executable file
·138 lines (99 loc) · 4.44 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php require_once('config.php');?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel= "stylesheet" href = ./bootstrap.min.css>
<title>Pawtastic</title>
</head>
<!-- Nav Bar Start-->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<a class="navbar-brand" href="#">Paw Tastic</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor03" aria-controls="navbarColor03" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarColor03">
<ul class="navbar-nav me-auto">
<li class="nav-item">
<a class="nav-link active" href="index.php">Home
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="Appointment.php">Shedule an Appointment</a>
</li>
<li class="nav-item">
<a class="nav-link" href="addClient.php">Add A New Client</a>
</li>
<li class="nav-item">
<a class="nav-link" href="newPet.php">Add A New Pet</a>
</li>
<li class="nav-item">
<a class="nav-link" href="viewCutCards.php">View Cut Cards</a>
</li>
<li class="nav-item">
<a class="nav-link" href="invoice.php">Invoice</a>
</li>
<li class="nav-item">
<a class="nav-link" href="stats.php">Stats</a>
</li>
<li class="nav-item">
<a class="nav-link" href="about.html">About</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- Nav Bar End-->
<body>
<!--
`INSERT INTO PET_OWNER (Name, Phone, Email, Address, Note)
VALUES ('Thomas Hills', '(888)456-7891', 'thill91@gmail.com', '10 Street SW Kent, WA', '');
-->
<form id="leform" action="addClient.php" method = "POST">
<div class="form-group">
<label for="clname">Full Name</label>
<input type="text" id="clname" name="clname" placeholder="Enter Full Name" required>
<label for="exampleInputEmail1" class="form-label mt-4">Email address</label>
<input type="email" placeholder="Enter email" required name = "email">
<label for="phone" class="form-label mt-4" >Phone Number</label>
<input type="tel" id="phone" name="phone"
pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}"
placeholder="Enter Phone Number"
required>
<label>Adress</label>
<input id="address" name = "address" type="text" placeholder="Enter Address" required>
<label>Notes</label>
<input id="notes" name = "notes" type="text" placeholder="Any Notes?" required>
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</form>
<?php
$connection = mysqli_connect(DBHOST, DBUSER, DBPASS, DBNAME);
if ( mysqli_connect_errno() )
{
die( mysqli_connect_error() );
}
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if ( mysqli_connect_errno() )
{
die( mysqli_connect_error() );
}
$sql = "INSERT INTO PET_OWNER (Name, Phone, Email, Address, Note)
VALUES ('{$_POST['clname']}', '{$_POST['phone']}', '{$_POST['email']}', '{$_POST['address']}', '{$_POST['notes']}');";
echo $sql;
$result = mysqli_query($connection, $sql);
if (!$result) {
die('Error: ' . mysqli_error($connection));
}
echo '<div class="alert alert-dismissible alert-success">
<strong>Client Added!!</strong><a href="newPet.php">would you like to attach a pet</a>
</div>
';
}
?>
</body>
</html>