make checkbox keep state
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 24 Sep 2017 18:20:22 +0000 (20:20 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 24 Sep 2017 18:20:22 +0000 (20:20 +0200)
temp2.sh

index 3d50c6c..64ac459 100755 (executable)
--- a/temp2.sh
+++ b/temp2.sh
@@ -49,6 +49,9 @@ fi
 
 set > /dev/shm/temp2.cgi.vars
 
+lines_checked=""
+test "$LINES" = 1 && lines_checked="checked"
+
 if echo $HTTP_USER_AGENT | grep Mozilla > /dev/null ; then
        echo "Content-type: text/html\r\n\r\n"
        cat << __HTML__
@@ -56,9 +59,10 @@ if echo $HTTP_USER_AGENT | grep Mozilla > /dev/null ; then
 <form method="get" action="/temp2.sh" style="position: fixed; top: 0; left: 0">
 <input type=submit name="t" value="48h">
 <input type=submit name="t" value="24h">
+<input type=submit name="t" value="12h">
 <input type=submit name="t" value="6h">
 <input type=submit name="t" value="1h">
-<input type=checkbox name="lines" value="1">
+<input type=checkbox name="lines" $lines_checked> <!-- $LINES -->
 </form>
 <img src="/temp2.png">
 </body>