-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomer_data.php
More file actions
183 lines (140 loc) · 4.24 KB
/
Copy pathcustomer_data.php
File metadata and controls
183 lines (140 loc) · 4.24 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php
require_once 'config.php';
error_reporting(0);
$full_name = $email = $phone = $gender = $age = $address =$purchase_f = $avg = "";
if ($_SERVER['REQUEST_METHOD'] == "POST"){
$full_name = trim($_POST['full_name']);
$email = trim($_POST['email']);
$phone = trim($_POST['phone']);
$gender = trim($_POST['gender']);
$age = trim($_POST['age']);
$address = trim($_POST['address']);
$purchase_f = trim($_POST['purchase_f']);
$avg = trim($_POST['avg']);
$sql = "INSERT INTO customer_data( email, full_name, phone,gender, age, address,purchase_frequency ,avg_price) VALUES( '$email' ,'$full_name ', '$phone', '$gender', '$age', '$address', '$purchase_f', '$avg')";
$result = mysqli_query($conn, $sql);
if ($result)
{ header("location: data.php");
}
else{
echo"something went wrong". mysqli_error();
}
}
?>
<!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">
<title>Customer Data</title>
<link href="css/cutomer_data.css" type="text/css" rel="stylesheet">
</head>
<body>
<header>
<nav class="navbar">
<ul>
<li><a href="logout.php"> <button class="logbtn">Log out</button></a></li>
<!-- <li><a href="#">About</a></li> -->
<li><a href="FAQs Page(customers).php">FAQs</a></li>
<li><a href="profiles.php">Customer Profiles</a></li>
<li><a href="proreport_form.php">Reports</a></li>
<li><a href="complaints.php"> Complaints</a></li>
<li><a href="data.php"> Customer Data</a></li>
<li><a href="target_data.php"> Target customers</a></li>
<li><a href="emp_offer.php">Offers</a></li>
<li><a href="#" class="active">Home </a></li>
<img src="img/crm-icon-png.png" alt="logo">
</ul>
</nav>
</header>
<h1>Add New Customer</h1>
<form id="form" action="customer_data.php" method="post">
<!-- Create Form -->
<form >
<!-- Details -->
<div class="form-control">
<label for="name" id="label-name">
Name
</label>
<!-- Input Type Text -->
<input type="text"
id="name" name="full_name"
placeholder="Enter name" />
</div>
<div class="form-control">
<label for="email" id="label-email">
Email
</label>
<!-- Input Type Email-->
<input type="email"
id="email" name="email"
placeholder="Enter email" />
</div>
<div class="form-control">
<label for="phne" id="label-email">
Phone
</label>
<!-- Input Type Email-->
<input type="tel"
id="phne" name="phone"
placeholder="Enter phone number" />
</div>
<div class="form-control">
<label for="age" id="label-age">
Age
</label>
<!-- Input Type Text -->
<input type="text"
id="age" name="age"
placeholder="Enter age" />
</div>
<div class="form-control">
<label for="gender" id="label-role">
Gender
</label>
<!-- Dropdown options -->
<select name="gender" id="gender">
<option
value="male">Male</option>
<option value="female">FeMale</option>
<option value="other">Other</option>
</select>
</div>
<div class="form-control">
<label for="address" id="label-age">
Address
</label>
<!-- Input Type Text -->
<input type="text"
id="address" name="address"
placeholder="Enter address" />
</div>
<div class="form-control">
<label for="purchase_f" id="label-age">
Purchase Frequency
</label>
<!-- Input Type Text -->
<input type="text"
id="purchase_f" name="purchase_f"
placeholder="Enter Purchase Frequency" />
</div>
<div class="form-control">
<label for="avg" id="label-age">
Average rate
</label>
<!-- Input Type Text -->
<input type="number"
id="avg" name="avg"
placeholder="Enter buying price" />
</div>
<!-- Multi-line Text Input Control -->
<button type="submit" value="submit" name="submit">
Add
</button>
</form>
</body>
</html>
</form>
</body>
</html>