-
Notifications
You must be signed in to change notification settings - Fork 0
/
addBlogModal.php
202 lines (197 loc) · 11.6 KB
/
addBlogModal.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
<?php
include "connection.php";
check_login($conn);
$isUpdate = $_GET['edit'];
$updateId = $_GET['editid'];
$fileName = $_GET['fileName'];
$submitBlogValues = array("", "", "", "", "", "", "", "", "", "", "", "","", 0);
$showTotalBlogQuery = "SELECT * FROM blog_information";
$runTotalBlogQuery = mysqli_query($conn, $showTotalBlogQuery);
$runTotalBlogQueryClone = mysqli_query($conn, $showTotalBlogQuery);
$runTotalBlogQueryCloneThird = mysqli_query($conn, $showTotalBlogQuery);
if ($isUpdate == "true") {
$getBlogFromDb = "SELECT * FROM blog_information WHERE blog_id= '$updateId'";
$runBlogQuery = mysqli_query($conn, $getBlogFromDb);
if (mysqli_num_rows($runBlogQuery) > 0) {
while ($getSingleEditBlog = mysqli_fetch_assoc($runBlogQuery)) {
$submitBlogValues[0] = $getSingleEditBlog['blog_title'];
$submitBlogValues[1] = $getSingleEditBlog['tracking_site_name'];
$submitBlogValues[2] = $getSingleEditBlog['tracking_site_link'];
$submitBlogValues[3] = $getSingleEditBlog['blog_markup_before'];
$submitBlogValues[4] = $getSingleEditBlog['blog_markup_after'];
$submitBlogValues[5] = $getSingleEditBlog['linked_tracking'];
$submitBlogValues[6] = $getSingleEditBlog['tracking_site_phone'];
$submitBlogValues[7] = $getSingleEditBlog['tracking_site_display_link'];
$submitBlogValues[8] = $getSingleEditBlog['blog_meta_data'];
$submitBlogValues[9] = $getSingleEditBlog['blog_first_show'];
$submitBlogValues[10] = $getSingleEditBlog['blog_second_show'];
$submitBlogValues[11] = $getSingleEditBlog['blog_third_show'];
$submitBlogValues[12] = $getSingleEditBlog['image_alt_tag'];
$submitBlogValues[13] = $getSingleEditBlog['have_subdomain'];
}
}
}
?>
<!doctype html>
<html lang="en">
<head>
<title>Packstrack</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">
<link rel="icon" type="image/x-icon" href="./images/trackingLogo.png">
</head>
<body>
<div class="wrapper d-flex align-items-stretch">
<!-- Page Content -->
<div id="content" class="">
<?php
include "nav.php"
?>
<div class="w-100 p-5">
<form method="post" action="codeFormSubmit?edit=<?php echo $isUpdate ?>&editid=<?php echo $updateId ?>&fileName=<?php echo $fileName ?>" enctype="multipart/form-data">
<div class="row">
<div class="form-group col-6">
<label for="blogTitle">Blog Title</label>
<input type="text" name="blogTitle" id="blogTitle" class="form-control" value="<?php echo $submitBlogValues[0] ?>">
</div>
<div class="form-group col-6">
<label for="siteName">Tracking Site Name</label>
<input type="text" name="siteName" id="siteName" class="form-control" value="<?php echo $submitBlogValues[1] ?>">
</div>
</div>
<div class="row">
<div class="form-group col-sm-4">
<label for="blogTitle">Display Phone Number</label>
<input type="text" name="displayPhone" id="blogTitle" class="form-control" value="<?php echo $submitBlogValues[6] ?>">
</div>
<div class="form-group col-sm-4">
<label for="siteName">Display Tracking Site</label>
<input type="text" name="displayLink" id="siteName" class="form-control" value="<?php echo $submitBlogValues[7] ?>">
</div>
<div class="form-group col-sm-4">
<label for="altTagText">Alt Tag Text</label>
<input type="text" name="altTagText" id="altTagText" class="form-control" value="<?php echo $submitBlogValues[12] ?>">
</div>
</div>
<div class="row">
<div class="form-group col-sm-3">
<label for="siteLink">Tracking Site Link</label>
<input type="text" name="siteLink" id="siteLink" class="form-control" value="<?php echo $submitBlogValues[2] ?>">
</div>
<div class="form-group col-sm-3">
<label for="includeImage">Image</label>
<input type="file" name="includeImage" id="includeImage" class="form-control" value="<?php echo $submitBlogValues[2] ?>">
</div>
<div class="form-group col-sm-3">
<label for="exampleFormControlSelect1">Linked Tracking</label>
<select class="form-control" id="exampleFormControlSelect1" name="linked_track">
<option value="false" <?php if ($submitBlogValues[5] == "false") echo 'selected="selected"'; ?>>False</option>
<option value="true" <?php if ($submitBlogValues[5] == "true") echo 'selected="selected"'; ?>>True</option>
</select>
</div>
<div class="form-group col-sm-3">
<label for="exampleFormControlSelect1">Have Subdomian</label>
<select class="form-control" id="exampleFormControlSelect1" name="have-sub-domain">
<option value="0" <?php if (!$submitBlogValues[13]) echo 'selected="selected"'; ?>>False</option>
<option value="1" <?php if ($submitBlogValues[13]) echo 'selected="selected"'; ?> disabled>True</option>
</select>
</div>
</div>
<div class="row">
<div class="form-group col">
<label for="exampleFormControlSelect1">First Reference</label>
<select class="form-control" id="exampleFormControlSelect1" name="first_ref">
<option value="">Select</option>
<?php
if (mysqli_num_rows($runTotalBlogQuery) > 0) {
while ($getSingleBlog = mysqli_fetch_assoc($runTotalBlogQuery)) {
?>
<option value="<?php
echo $getSingleBlog['blog_id'] ?>"<?php
if ($submitBlogValues[9] == $getSingleBlog['blog_id'])
echo 'selected="selected"'; ?>>
<?php
echo $getSingleBlog['tracking_site_name'];
?>
</option>
<?php
}
}
?>
</select>
</div>
<div class="form-group col-sm-3">
<label for="exampleFormControlSelect1">Second Reference</label>
<select class="form-control" id="exampleFormControlSelect1" name="second_ref">
<option value="">Select</option>
<?php
if (mysqli_num_rows($runTotalBlogQueryClone) > 0) {
while ($getSingleBlog = mysqli_fetch_assoc($runTotalBlogQueryClone)) {
?>
<option value="<?php
echo $getSingleBlog['blog_id'] ?>"<?php
if ($submitBlogValues[10] == $getSingleBlog['blog_id'])
echo 'selected="selected"'; ?>>
<?php
echo $getSingleBlog['tracking_site_name'];
?>
</option>
<?php
}
}
?>
</select>
</div>
<div class="form-group col-sm-3">
<label for="exampleFormControlSelect1">Third Reference</label>
<select class="form-control" id="exampleFormControlSelect1" name="third_ref">
<option value="">Select</option>
<?php
if (mysqli_num_rows($runTotalBlogQueryCloneThird) > 0) {
while ($getSingleBlog = mysqli_fetch_assoc($runTotalBlogQueryCloneThird)) {
?>
<option value="<?php
echo $getSingleBlog['blog_id'] ?>"
<?php
if ($submitBlogValues[11] == $getSingleBlog['blog_id'])
echo 'selected="selected"'; ?>>
<?php
echo $getSingleBlog['tracking_site_name'];
?>
</option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="form-group">
<label for="blogData">Add Meta Data</label>
<textarea name="blogMetaDesc" id="blogMetaDesc" class="form-control" rows="8"><?php echo $submitBlogValues[8] ?></textarea>
</div>
<!-- Being Used in PHP Code But Not Needed for Implementing -->
<div class="form-group d-none">
<label for="blogData">Add Markup Before Tracking</label>
<textarea name="blogData" id="blogData" class="form-control" rows="8"><?php echo $submitBlogValues[3] ?></textarea>
</div>
<!-- Being Used in PHP Code But Not Needed for Implementing -->
<div class="form-group">
<label for="blogAfter">Add Markup After Tracking</label>
<textarea name="blogAfter" id="blogAfter" class="form-control" rows="8"><?php echo $submitBlogValues[4] ?></textarea>
</div>
<div class="modal-footer">
<input type="submit" name="blogSubmit" id="" class="btn btn-primary btn-block w-25">
</div>
</form>
</div>
</div>
</div>
<?php
include "scripts.php";
?>
</body>
</html>