I have a web server running a simple php page with a few buttons (12345678) These buttons control the lights in my house through an arduino.
Now I want to create a simple app to control these buttons. The PHP script is posted below:
<?php if (isset($_POST['button1'])) { shell_exec('screen -S led -X stuff 1'); } ?>
<?php if (isset($_POST['button2'])) { shell_exec('screen -S led -X stuff 2'); } ?>
<?php if (isset($_POST['button3'])) { shell_exec('screen -S led -X stuff 3'); } ?>
<?php if (isset($_POST['button4'])) { shell_exec('screen -S led -X stuff 4'); } ?>
<?php if (isset($_POST['button5'])) { shell_exec('screen -S led -X stuff 5'); } ?>
<?php if (isset($_POST['button6'])) { shell_exec('screen -S led -X stuff 6'); } ?>
<?php if (isset($_POST['button7'])) { shell_exec('screen -S led -X stuff 7'); } ?>
<?php if (isset($_POST['button8'])) { shell_exec('screen -S led -X stuff 8'); } ?>
<form action="" method="post">
<button type="submit" name="button1">AV Rack</button>
<br>
<button type="submit" name="button2">Scherm bureau + LEDs</button>
<br>
<button type="submit" name="button4">Woonkamer LEDs + Beamer</button>
<br>
<button type="submit" name="button3">Buiten Achter</button>
<br>
<button type="submit" name="button5">Red LED test</button>
<br>
<button type="submit" name="button6">Error test</button>
<br>
<button type="submit" name="button7">Alles aan</button>
<br>
<button type="submit" name="button8">Alles uit</button>
</form>
Could someone point me in the right direction?
EDIT:
I really did get somewhere but not all the way.
App is working and sending commands as it should. The web interface is still up and running
I think my server (ubuntu) doesn't accept the info/command I send it. I think I'm doing something wrong from the command end.
index.php?action=""&method="post"&type="submit"&name="button1"
If i put that in my browser url bar or any other string that I tried doesn't give me a result but just the page with the buttons.
Any suggestions?