version 0.0.1
[fms.git] / admin / options.php
1 <?php\r
2 \r
3         include_once('config.php');\r
4         \r
5         if(isset($_REQUEST['formaction']) && $_REQUEST['formaction']=='saveoptions')\r
6         {\r
7                 $db=new PDO('sqlite:'.$dblocation);\r
8                 $st=$db->prepare("UPDATE tblOption SET OptionValue=? WHERE Option=?;");\r
9                 foreach($_REQUEST as $key=>$val)\r
10                 {\r
11                         $st->bindParam(1,$val);\r
12                         $st->bindParam(2,$key);\r
13                         $st->execute();\r
14                 }\r
15         }\r
16 \r
17 function content()\r
18 {\r
19         global $dblocation;\r
20         $db=new PDO('sqlite:'.$dblocation);\r
21         \r
22         $rs=$db->query("SELECT Option, OptionValue, OptionDescription FROM tblOption;");\r
23         \r
24 ?>\r
25         <h2 style="text-align:center;">Options</h2>\r
26         <form name="frmoptions" method="post">\r
27         <input type="hidden" name="formaction" value="saveoptions">\r
28         <table>\r
29                 <tr>\r
30                         <th>Option</th>\r
31                         <th>Value</th>\r
32                         <th>Description</th>\r
33                 </tr>\r
34                 <?php\r
35                 while($record=$rs->fetch())\r
36                 {\r
37                         print '<tr>';\r
38                         print '<td valign="TOP">'.$record[0].'</td>';\r
39                         print '<td valign="TOP"><input type="text" name="'.$record[0].'" value="'.$record[1].'"></td>';\r
40                         print '<td valign="TOP">'.$record[2].'</td>';\r
41                         print '</tr>';\r
42                 }\r
43                 ?>\r
44                 <tr>\r
45                         <td colspan="3">\r
46                                 <center>\r
47                                 <input type="submit" value="Save">\r
48                                 </center>\r
49                         </td>\r
50                 </tr>\r
51         </table>\r
52 <?php\r
53 }\r
54 \r
55         include_once('linkbar.php');\r
56         include_once('template.php');\r
57 \r
58 ?>