-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd-videos.php
101 lines (94 loc) · 4.76 KB
/
add-videos.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
<?php
require_once 'include/header.php';
?>
<div class="container-fluid body-section mt-5 pt-5">
<div class="row">
<div class="col-md-3">
<?php
require_once 'include/sidebar.php';
?>
</div>
<div class="col-md-9">
<h1><i class="fas fa-plus-square"></i> Add Videos <small>New Videos</small></h1>
<hr>
<ol class="breadcrumb">
<li class="mr-2"><a href="teacherdashboard.php"><i class="fas fa-tachometer-alt"></i> Dashboard </a>
</li>
<span> / </span>
<li class="breadcrumb-item active ml-2 "><i class="fas fa-plus-square"></i> Add Videos</li>
</ol>
<div class="row">
<div class="col-md-8">
<?php
$teacherUid = $_SESSION['useruid'];
$sql = "SELECT teacherId FROM teacher WHERE teacherUid='$teacherUid'";
$run1 = mysqli_query($conn, $sql);
$row1 = mysqli_fetch_assoc($run1);
$teacherId = $row1['teacherId'];
?>
<form action="include/add-videos.inc.php?" method="post" enctype="multipart/form-data">
<div class="form-label-group pb-2">
<input type="hidden" name="teacherUid" value="<?php echo $teacherUid; ?>">
<input type="hidden" name="teacherId" value="<?php echo $teacherId; ?>">
<label for="videoTitle">Video Title</label>
<input type="text" id="videoTitle" class="form-control" placeholder="Video Title" name="videoTitle" required autofocus>
</div>
<div class="form-label-group pb-2">
<label class="form-label" for="customFile">Video File</label>
<br>
<input type="file" name="file" class="form-control" id="customFile" required>
</div>
<label for="option">Please select a Upload option.</label>
<select class="custom-select d-block w-100" type="text" name="videoStatus" id="option" required>
<option value="">Upload as</option>
<option>Publish</option>
<option>Draft</option>
</select>
<label for="option">Please select a Service option.</label>
<select class="custom-select d-block w-100" type="text" name="servicesTitle" id="option" required>
<option>Post in</option>
<?php
$query = "SELECT * FROM services WHERE servicesStatus='Publish' AND teacherUid='$teacherUid'";
$run = mysqli_query($conn, $query);
if (mysqli_num_rows($run) > 0) {
while ($row = mysqli_fetch_array($run)) {
$servicesTitle = $row['servicesTitle'];
?>
<option value="<?php echo $row['servicesId'] . '-' . $servicesTitle ?>"><?php echo $servicesTitle; ?></option>
<?php
}
} else {
?>
<option>No Services Yet</option>
<?php
}
?>
</select>
<div class="form-label-group pt-2">
<label for="videoDiscription">Video Description</label>
<textarea class="form-control" name="videoDiscription" id="videoDiscription" cols="50" rows="5" required></textarea>
</div>
<hr>
<button class="btn btn-lg btn-primary btn-block text-uppercase" type="submit" name="submit">Add Videos</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
if (isset($_GET["error"])) {
if ($_GET["error"] == "none") {
echo '<script type="text/javascript">';
echo ' alert("Video Uploaded")'; //not showing an alert box.
echo '</script>';
} else if ($_GET["error"] == "videoformat") {
echo '<script type="text/javascript">';
echo ' alert("Please select mp4 video.")'; //not showing an alert box.
echo '</script>';
}
}
?>
<?php
require_once 'include/footer.php';
?>