-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypeedit.php
221 lines (137 loc) · 4.65 KB
/
typeedit.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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<?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');
?>
<link rel="stylesheet" href="css/bootstrap-wysihtml5.css" />
<div class="pageheader">
<h2><i class="fa fa-th-list"></i> EDIT Cloth Type List</h2>
</div>
<div class="contentpanel">
<div class="panel panel-default">
<div class="panel-body">
<?php
$eid = $_GET["id"];
if($_POST)
{
$title = $_POST["title"];
$sex = $_POST["sex"];
////////////////////-------------------->> TITLE ki faka??
if(trim($title)=="")
{
$err1=1;
}
if(isset($err1))
$error = $err1;;
if (!isset($error) || $error == 0){
$res = $pdo->exec("UPDATE type SET title='".$title."', sex='".$sex."' WHERE id='".$eid."'");
if($res){
echo "<div class='alert alert-success alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
UPDATED Successfully!
<meta http-equiv='refresh' content='2; url=typeview.php' />
</div>";
}else{
echo "<div class='alert alert-danger alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
Some Problem Occurs, Please Try Again.
</div>";
}
} else {
if (!isset($err1) || $err1 == 1){
echo "<div class='alert alert-danger alert-dismissable'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
Title Can Not be Empty!!!
</div>";
}
}
}
$oldd = $pdo->query("SELECT title, sex FROM type WHERE id='".$eid."'");
$old = $oldd->fetch(PDO::FETCH_ASSOC)
?>
<form action="" method="post">
<div class="form-group">
<label class="col-sm-3 control-label">Name</label>
<div class="col-sm-6">
<?php
echo " <input name='title' value='$old[title]' class='form-control' type='text'>";
?>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Sex</label>
<div class="col-sm-6"><select name="sex" class="form-control">
<option value="0" <?php if($old['sex']== 0) echo('selected = "selected"'); ?>>Male</option>
<option value="1"<?php if($old['sex']== 1) echo('selected = "selected"'); ?>>Female</option>
</select></div>
<div class="col-sm-3 col-sm-offset-3" style="width:200px;"><br/>
<input type="submit" class="btn btn-lg btn-success btn-block" value="Submit">
</div>
</form>
</div>
</div>
</div><!-- contentpanel -->
</div><!-- mainpanel -->
</section>
<?php
include ('footer.php');
?>
<script src="js/bootstrap-timepicker.min.js"></script>
<script src="js/wysihtml5-0.3.0.min.js"></script>
<script src="js/bootstrap-wysihtml5.js"></script>
<script src="js/ckeditor/ckeditor.js"></script>
<script src="js/ckeditor/adapters/jquery.js"></script>
<script>
jQuery(document).ready(function(){
"use strict";
// HTML5 WYSIWYG Editor
jQuery('#wysiwyg').wysihtml5({color: true,html:true});
// CKEditor
jQuery('#ckeditor').ckeditor();
jQuery('#inlineedit1, #inlineedit2').ckeditor();
// Uncomment the following code to test the "Timeout Loading Method".
// CKEDITOR.loadFullCoreTimeout = 5;
window.onload = function() {
// Listen to the double click event.
if ( window.addEventListener )
document.body.addEventListener( 'dblclick', onDoubleClick, false );
else if ( window.attachEvent )
document.body.attachEvent( 'ondblclick', onDoubleClick );
};
function onDoubleClick( ev ) {
// Get the element which fired the event. This is not necessarily the
// element to which the event has been attached.
var element = ev.target || ev.srcElement;
// Find out the div that holds this element.
var name;
do {
element = element.parentNode;
}
while ( element && ( name = element.nodeName.toLowerCase() ) &&
( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' );
if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 )
replaceDiv( element );
}
var editor;
function replaceDiv( div ) {
if ( editor )
editor.destroy();
editor = CKEDITOR.replace( div );
}
jQuery('#timepicker').timepicker({defaultTIme: false});
jQuery('#timepicker2').timepicker({showMeridian: false});
jQuery('#timepicker3').timepicker({minuteStep: 15});
});
</script>
</body>
</html>