-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom_red_alert.php
84 lines (72 loc) · 2.15 KB
/
custom_red_alert.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
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once('functions.php');
if(isset($_POST['id'])){
if ($_POST['type']=='default')
echo "Please select One of the select option";
else if($_POST['type'] == '0' && $_POST['max-entry']=="")
echo "Please choose max entry";
else if($_POST['type'] == '1' && ($_POST['time_from'] == "" || $_POST['time_to'] == ""))
echo "Please choose the dates";
else addRedAlert();
}
?>
<form method="POST" action="custom_red_alert.php">
<table>
<tr>
<td><input type="text" placeholder="ID" name="id"/></td>
</tr>
<tr>
<td>
<select id="type" name="type">
<option value="default">Select Type</option>
<option value="0">Max Entry</option>
<option value="1">Entry/Exit between specific time</option>
</select>
</td>
</tr>
<tr id="max-entry" style="display:none">
<td>
<input type="text" placeholder="max-entry" name="max-entry"/>
</td>
</tr>
<tr id="time_from" style="display:none">
<td>
<input type="text" placeholder="from" name="time_from" />
</td>
</tr>
<tr id="time_to" style="display:none">
<td>
<input type="text" placeholder="to" name="time_to" />
</td>
</tr>
<tr>
<td>
<input type="submit" value="submit" />
</table>
</form>
<script>
var card = document.getElementById("type");
card.onchange = function(){
var value = card.value;
if(value==0){
// $('#max-entry').css({
// dislay: 'inherit'
// });
document.getElementById('max-entry').style.display = 'inherit';
document.getElementById('time_from').style.display = 'none';
document.getElementById('time_to').style.display = 'none';
}
if(value==1){
document.getElementById('time_from').style.display = 'inherit';
document.getElementById('time_to').style.display = 'inherit';
document.getElementById('max-entry').style.display = 'none';
}
if(value=='default'){
document.getElementById('time_from').style.display = 'none';
document.getElementById('time_to').style.display = 'none';
document.getElementById('max-entry').style.display = 'none';
}
}
</script>