Adjusting form in configure
authorBrian Flowers <git-admn@bsflowers.net>
Fri, 23 Sep 2016 02:20:11 +0000 (22:20 -0400)
committerBrian Flowers <git-admn@bsflowers.net>
Fri, 23 Sep 2016 02:20:11 +0000 (22:20 -0400)
configure.php

index e0ecd7f..1de0aa1 100755 (executable)
@@ -60,7 +60,6 @@
         <a href="configure.php">Configuration</a>
         <a></a>
     </div>
-    <form id="attributes" method="POST" action="configure.php" />
     <table id="options">
       <tr>
         <th>Reading</th>
@@ -80,6 +79,8 @@ while($host = $result->fetchArray(SQLITE3_ASSOC))
 
 foreach ($hosts as $host)
 {
+    echo "<form id='attributes' method='POST' ".
+         "action='configure.php?host=<?php echo urlencode($host); ?>' />";
     echo "      <tr><th>$host</th>";
     echo "<th><input type='submit' value='Update host' /></th></tr>";
     $result = $db_handle->query("SELECT DISTINCT attribute FROM MEASUREMENTS WHERE host='$host'");
@@ -92,16 +93,16 @@ foreach ($hosts as $host)
     {
       echo "      <tr>";
       echo "        <td>$attribute</td>";
-      echo "        <td><input type='text' name='$host-$attribute-name' value='' /></td>";
-      echo "        <td><input type='checkbox' name='$host-$attribute-graph' /></td>";
-      echo "        <td><input type='text' name='$host-$attribute-min' value='' class='short'/> - ".
-                    "<input type='text' name='$host-$attribute-max' value='' class='short'/></td>";
-      echo "        <td><input type='text' name='$host-$attribute-duration' value='' class='short' /></td>";
+      echo "        <td><input type='text' name='$host|$attribute|name' value='' /></td>";
+      echo "        <td><input type='checkbox' name='$host|$attribute|graph' /></td>";
+      echo "        <td><input type='text' name='$host|$attribute|min' value='' class='short'/> - ".
+                    "<input type='text' name='$host|$attribute|max' value='' class='short'/></td>";
+      echo "        <td><input type='text' name='$host|$attribute|duration' value='' class='short' /></td>";
       echo "      </tr>";
     }
+    echo "</form>";
 }
 ?>
     </table>
-    </form>
   </BODY>
 </HTML>