-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
73 lines (61 loc) · 2.43 KB
/
test.php
File metadata and controls
73 lines (61 loc) · 2.43 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- Include jQuery + Select2 -->
<!-- <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> -->
<script src="test.js"></script>
<link rel="stylesheet" href="test.css">
</head>
<body>
<!-- Dropdown -->
<form method="get" action="test.php">
<select id="subject-select" name="okay[]" class="form-control" style="width:50vw" multiple>
<option value="math" selected>Math</option>
<option value="science">Science</option>
<option value="english">English</option>
</select>
<input type="submit" value="submit" />
</form>
<script>
$(document).ready(function() {
$('#subject-select').select2({
tags: true, // allows custom entries
placeholder: 'Select or add a subject',
allowClear: true,
tokenSeparators: [',']
});
});
// $(document).ready(function() {
// // Initialize Select2 with tagging enabled
// $('#subject-select').select2({
// tags: true, // allow new options
// placeholder: 'Select or add a subject',
// tokenSeparators: [',', ' '], // separate by comma or space
// allowClear: true, // adds a clear (X) button
// createTag: function(params) {
// var term = $.trim(params.term);
// if (term === '') return null;
// // Custom label for new options
// return {
// id: term,
// text: term,
// newTag: true // mark as new
// };
// },
// insertTag: function(data, tag) {
// // Put new tag at the end of the list
// data.push(tag);
// }
// });
// });
</script>
</body>
</html>
<?php
print_r($_GET['okay']);
?>