make select slider open multiple php scripts
I want to make one id trigger multiple php files. I`m using the slider to switch my light on and off, wich works great. But i can`t find a way to switch of all my lights at once.
HTML
<
label
for=
"slider"
><
font
size=
"4px"
>
Stopcontact
</
font
></
label
><
br
>
<
select
name=
"slider"
id=
"stopcontact"
data-role=
"slider"
>
<
option
value=
"schakelen.php?kanaal=a14&actie=uit&optie=0"
>
OFF
</
option
>
<
option
value=
"schakelen.php?kanaal=a14&actie=aan&optie=0"
>
ON
</
option
>
</
select
>
</
li
>
JAVASCRIPT
<
script
>
$(document).ready(function($) {
// wordt uitgevoerd als de pagina geladen is
$(
'#spot, #led, #bank, #living, #boom, #houtkast, #houtkast2, #stopcontact, #potten, #plafondspot, #haard'
).change(function(e) {
// wanneer de gebruiker de select verandert, doen we dit:
// Ajax aanroepen
var url = $(this).val();
// this is de <select>. .val() haalt de value op
$.ajax({
url: url,
success: function(message) {
}
});
});
})
</
script
>
PHP
<?php
if (
isset
($_GET[
'actie'
]) && $_GET[
'actie'
] ===
'aan'
) {
echo
'lamp is aan!'
;
}
else {
echo
'lamp is uit!'
;
}
$kanaal = $actie = $optie =
0
;
if(
isset
($_GET[
'kanaal'
])) $kanaal = $_GET[
'kanaal'
];
if(
isset
($_GET[
'actie'
])) $actie = $_GET[
'actie'
];
if(
isset
($_GET[
'optie'
])) $optie = $_GET[
'optie'
];
if(!
file_exists
(
"KAKUcli.exe"
)) {
die
(
"ERROR1: Het bestand KAKUcli.exe is niet gevonden!"
);
}
if(!
file_exists
(
"TPC200L10.dll"
)) {
die
(
"ERROR2: Het bestand TPC200L10.dll is niet gevonden!"
);
}
if(!
file_exists
(
"TPC300A.dll"
)) {
die
(
"ERROR3: Het bestand TPC300A.dll is niet gevonden!"
);
}
if(checkArrayForEmpty(Array($kanaal, $actie))) {
die
(
"ERROR4: Een belangrijke parameter is niet opgegeven!"
);
}
exec
(
"KAKUcli.exe "
.$kanaal.
" "
.$actie.
" "
.$optie);
print
(
"KAKUcli.exe "
.$kanaal.
" "
.$actie.
" "
.$optie.
" uitgevoerd!"
);
function checkArrayForEmpty($
array
) {
foreach($
array
AS $value) {
if(!$value) {
return
1
;
}
}
return
0
;
}
?>