-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomeradd.php
More file actions
176 lines (103 loc) · 3.75 KB
/
Copy pathcustomeradd.php
File metadata and controls
176 lines (103 loc) · 3.75 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
<?php
require_once('function.php');
dbconnect();
session_start();
if (!is_user()) {
redirect('index.php');
}
?>
<?php
$user = $_SESSION['username'];
$usid = $pdo->query("SELECT id FROM users WHERE username='".$user."'");
$usid = $usid->fetch(PDO::FETCH_ASSOC);
$uid = $usid['id'];
include ('header.php');
?>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Add Customer</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-md-10 col-md-offset-1">
<?php
if($_POST)
{
$fullname = $_POST["fullname"];
$address = $_POST["address"];
$phonenumber = $_POST["phonenumber"];
$sex = $_POST["sex"];
$email = $_POST["email"];
$city = $_POST["city"];
$comment = $_POST["comment"];
$res = $pdo->exec("INSERT INTO customer SET fullname='".$fullname."', address='".$address."', phonenumber='".$phonenumber."', sex='".$sex."',`email`='".$email."',`city`='".$city."',`comment`='".$comment."'");
$cid = $pdo->lastInsertId();
if($res){
echo "<div class='alert alert-success alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
Customer Added Successfully!
</div>
<meta http-equiv='refresh' content='2; url=addmeasurement.php?id=$cid' />
";
}
}
?>
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
<form action="customeradd.php" method="post">
<div class="form-group">
<label>Full Name</label><br/>
<input type="text" name="fullname" style="width:200px; height: 40px;" /><br/><br/>
</div>
<div class="form-group">
<label>Address</label><br/>
<input type="text" name="address" style="width:200px; height: 40px;" /><br/><br/>
</div>
<div class="form-group">
<label>Phone Number</label><br/>
<input type="text" name="phonenumber" style="width:200px; height: 40px;" /><br/><br/>
</div>
<div class="form-group">
<label>City</label><br/>
<input type="text" name="city" style="width:200px; height: 40px;" /><br/><br/>
</div>
<div class="form-group">
<label>Email</label><br/>
<input type="text" name="email" style="width:200px; height: 40px;" /><br/><br/>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Comment</label><br/><br/>
<div class="col-sm-6"><textarea rows="4" cols="50" name="comment" class="form-control" type="text" /></textarea></div>
</div>
<div class="form-group">
<label>Sex</label><br/>
<select name="sex" class="form-control">
<option value="0">Male</option>
<option value="1">Female</option></select><br/><br/>
</div>
<input type="submit" class="btn btn-lg btn-success btn-block" value="ADD">
</form>
</div>
</div>
<!-- /.row -->
</div>
<!-- /#page-wrapper -->
<script src="js/bootstrap-timepicker.min.js"></script>
<script>
jQuery(document).ready(function(){
jQuery("#ssn").mask("999-99-9999");
// Time Picker
jQuery('#timepicker').timepicker({defaultTIme: false});
jQuery('#timepicker2').timepicker({showMeridian: false});
jQuery('#timepicker3').timepicker({minuteStep: 15});
});
</script>
<?php
include ('footer.php');
?>