So I'm creating a system that turns a motor for about 5 seconds and then turns off, but I want the user to be able to input what times they want the system to go off at ideally. I was thinking of having 3 inputs that the user can enter the desired time into and then press submit and have them get set. I'm not sure how I can do this because I'm using a Pi Zero W hosting Apache web server on it and its in access point mode so that it doesn't need to be connected to internet to work. However, I'm not sure how to set all this up in PHP and HTML.
Due to not being connected to the internet, I don't think I can use times, so I was thinking of letting the user choose how long from now they want it to be activated - e.g. 6 hours from now, 12 hours and 18 hours. I have used hostapd, dnsmasq apache2 and php7 on my Pi to get this far, and everything is working correctly except this is the last bit I need. I've managed to access both index.html and index.php files from another device that's connected to the Pi's access point.
Security and validation isn't a concern because I just need to get the concept working and that will be fine, however I have no clue how to go about doing this without connecting to the internet. Any help would be incredibly helpful - Thank you!!!
This is the code I'm using at the moment, however this just turns the motor on and off, but I'm just using it as testing to see if the motor would turn of via this method (index.php):
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Motor Control</title>
</head>
<body>
Motor Control:
<form method="get" action="index.php">
<input type="submit" value="ON" name="on">
<input type="submit" value="OFF" name="off">
</form>
<?php
$setmode23 = shell_exec("/usr/local/bin/gpio -g mode 23 out");
if(isset($_GET['on'])){
$gpio_on = shell_exec("/usr/local/bin/gpio -g write 23 1");
echo "Motor is on";
}
else if(isset($_GET['off'])){
$gpio_off = shell_exec("/usr/local/bin/gpio -g write 23 0");
echo "Motor is off";
}
?>
</body>
</html>