-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsearch.php
More file actions
52 lines (45 loc) · 1.79 KB
/
search.php
File metadata and controls
52 lines (45 loc) · 1.79 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
<!DOCTYPE html>
<!--An interface for the users to search-->
<html>
<link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<style>
#head1{
font-size: 2.8em;
font-weight: bolder;
color:darkslategray;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
</style>
<body>
<div class="container" ng-app="myApp" ng-controller="cntrl">
<h1 align="center" class="page-header" id="head1">Search</h1>
<div class="form-group">
<!-- text box for searching-->
<label for="txtFirstName">Search the file that you are looking for</label>
<input type="text" id="filename" ng-model="filename" class="form-control" name="filename" />
<br/>
<!-- search button. search() method will be called when the button is clicked-->
<input type="button" class="btn btn-success btn-block" value="Search" ng-click="search()"/>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('cntrl', function ($scope, $http) {
$scope.search = function () { //posting the string written in the field as the filename
if($scope.filename != null){ //assure that the user has written something for search
$http.post("select_data_for_search.php", { 'filename': $scope.filename })
.success(function (data) {
alert(data);
$scope.filename = null;
});
window.location="tableIndex.php"; //Change the page if search is valid
}
else{//if the search field is empty
alert('The search field is empty. Please write the name of the file that you are looking for.');
}
}
});
</script>
</body>
</html>