Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Achmed! - search</title>
- </head>
- <body>
- <h1>Hederlige Achmeds Kamel och Bostadshandel</h1>
- <?php
- //phpinfo();
- $link = pg_connect("host=pgsql0 dbname=jlaurin user=jlaurin password=secret");
- $result = pg_exec($link, "select * from bostader");
- $numrows = pg_numrows($result);
- $lanarray = array();
- $typarray = array();
- $rumarray = array();
- for ($i = 0; $i < $numrows; $i++) {
- $disrow = pg_fetch_array($result, $i);
- if (!in_array($disrow["lan"],$lanarray)) {
- array_push($lanarray, $disrow["lan"]);
- }
- if (!in_array($disrow["objekttyp"],$typarray)) {
- array_push($typarray, $disrow["objekttyp"]);
- }
- if (!in_array($disrow["rum"],$rumarray)) {
- array_push($rumarray, $disrow["rum"]);
- }
- }
- pg_close($link);
- ?>
- <form name="bostadsform" action="result.php" method="get">
- <!-- <input type="hidden" name="sort" value="lan"/> -->
- <?php
- echo "<input type =\"hidden\" name=\"numtyper\" value=\"",count($typarray),"\"/>";
- ?>
- <table border="1">
- <tr>
- <th>LÄN!</th>
- <th>BOSTADSTYP!</th>
- <th>ANTAL RUM DU SKA HA!</th>
- </tr>
- <tr>
- <td>
- <?php
- echo "<table border=\"0\">\n";
- for ($i = 0; $i < count($lanarray); $i++) {
- echo "<tr>\n";
- echo "<td> <input type = \"checkbox\" name = \"lan",$i,"\" value = \"",$lanarray[$i],"\"/> ",$lanarray[$i],"</td>\n";
- echo "</tr>\n";
- }
- echo "</table>\n";
- ?>
- </td>
- <td>
- <?php
- echo "<table border=\"0\">\n";
- for ($i = 0; $i < count($typarray); $i++) {
- echo "<tr>\n";
- echo "<td> <input type = \"checkbox\" name = \"typ",$i,"\" value = \"",$typarray[$i],"\"/> ",$typarray[$i],"</td>\n";
- echo "</tr>\n";
- }
- echo "</table>\n";
- ?>
- </td>
- <td>
- <?php
- echo "<table border=\"0\">\n";
- for ($i = 0; $i < count($rumarray); $i++) {
- echo "<tr>\n";
- echo "<td> <input type = \"checkbox\" name = \"rum",$i,"\" value = \"",$rumarray[$i],"\"/> ",$rumarray[$i],"</td>\n";
- echo "</tr>\n";
- }
- echo "</table>\n";
- ?>
- </td>
- </tr>
- </table>
- <input type="submit" value="Resuldoken!" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement