-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesty.php
65 lines (45 loc) · 1.3 KB
/
testy.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
<?php
$db = require_once 'database.php';
$e100 ="E100";
var_dump(strtolower($e100));
exit();
?>
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(function() {
var select1 = $("#address-select");
var select2 = $('select[name="v2"].wariant2');
var a= <?php echo json_encode($e100); ?>;
select1.on('change', function(event) {
console.log(select1.val());
for(var i=0; i<a.length; i++){
console.log(a[i]['address']);
if(a[i]['address'] === select1.val()){
console.log(a[i]['id']);
};
}
});
});
</script>
</head>
<body>
<main>
<select id="address-select" name="name-curr" required>
<option disabled selected value> -- wybierz adres -- </option>
<?php
foreach($e100 as $part){
echo "<option>{$part['address']}</option>";
}
?>
</select>
<select name="v2" class="wariant2">
<option data-bind="1" value="1">Opcja 1</option>
<option data-bind="2" value="2">Opcja 2</option>
<option data-bind="0" value="3">Opcja 3</option>
</select>
</main>
</body>
</html>