-
Notifications
You must be signed in to change notification settings - Fork 0
/
uploadServices.php
138 lines (133 loc) · 4.84 KB
/
uploadServices.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
<?php
include 'session.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">
<title>File Upload</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
<link href="css/addNewItem.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="tinymce/tinymce.min.js"></script>
<script src="tinymce/jquery.tinymce.min.js"></script>
<script src="js/uploadAboutUs.js"></script>
<script type="text/javascript">
tinymce.init({
selector: '#mytextarea',
toolbar: 'undo redo styleselect bold italic alignleft aligncenter alignright bullist numlist outdent indent code',
setup: function(ed) {
ed.on("change", function(e){
$('#previewDetail').html(tinymce.activeEditor.getContent());
});
ed.on("keyup", function(){
$('#previewDetail').html(tinymce.activeEditor.getContent());
});
}
});
</script>
</head>
<body>
<?php
include_once('navbar.php');
?>
<div class="headerAddNewItem" align="center">
<h1>Update Services Content</h1>
</div>
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<a class="btn marginLink" href="./view.php">Back to Homepage</a>
<form action="serviceUpload.php" method="post" enctype="multipart/form-data">
<?php
$sql = "SELECT header,detail FROM contact_us WHERE id =5 ";
$resultQuery = $db->query($sql);
$count = ($resultQuery->rowCount() >0 ) ? true : false;
if($count >0){
$row = $resultQuery->fetch(PDO::FETCH_ASSOC);
}
$query = "SELECT * FROM output_images WHERE category = 'service' ORDER BY imageId DESC LIMIT 1";
$imgResult = $db->query($query);
$dbResultx = ($imgResult->rowCount() > 0) ? true : false;
if($dbResultx){
$row2 = $imgResult->fetch(PDO::FETCH_ASSOC);
}
?>
<div class="form-outline">
<div class="form-group">
<label for="name">Title</label>
<input type="text" id="header" name="header" class="form-control" placeholder="Enter Title here" value="<?php if($count >0){echo $row["header"];} ?>" required/>
</div>
<div class="form-group">
<span id="outer-upload" class="btn btn-default btn-file">
Upload Image <input type="file" id="imageaboutus" name="file" />
</span>
<img id="reviewImage" src="imageView.php?image_id=<?php if($dbResultx){ echo $row2["imageId"]; }else{ echo "0"; } ?>" alt="your image" />
</div>
<div class="form-group">
<label for="name">Description</label>
<textarea id="mytextarea" name="detail" class="form-control" placeholder="Enter Description here" required><?php if($count >0){echo $row["detail"];} ?></textarea>
</div>
<div class="input-group-btn">
<button type="submit" class="btn btn-success" name="btn-upload">Upload</button>
</div>
</div>
</form>
</div>
<div class="col-md-3"></div>
</div>
<hr>
<!-- Page Content -->
<div class="container card">
<!-- Page Heading/Breadcrumbs -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Preview Service
<!-- <small>Subheading</small> -->
</h1>
<ol class="breadcrumb">
<li><a href="home.html">Home</a>
</li>
<li class="active">Service</li>
</ol>
</div>
</div>
<!-- /.row -->
<!-- Image Header -->
<div class="row">
<div class="col-lg-12">
<img id="previewImg" class="img-responsive" src="imageView.php?image_id=<?php if($dbResultx){ echo $row2["imageId"]; }else{ echo "0"; } ?>" alt="">
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h2 id="previewHeader" class="page-header"><?php if($count >0){echo $row["header"];} ?></h2>
</div>
<div class="col-lg-12">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="service-one">
<div id="previewDetail">
<?php if($count >0){echo $row["detail"];} ?>
</div>
</div>
</div>
</div>
</div>
<hr>
<!-- Footer -->
<footer>
<div class="row">
<div class="col-lg-12">
<p>Copyright © THAI SU 2017</p>
</div>
</div>
</footer>
</div>
<!-- /.container -->
</body>
</html>