-
Notifications
You must be signed in to change notification settings - Fork 1
/
couleursuche.php
55 lines (40 loc) · 1.69 KB
/
couleursuche.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
include 'header.php';
$mysqli = new mysqli($sccdbhost, $sccdbuser, $sccdbpassword, $sccdbname);
$mysqli->set_charset("utf8");
/* check connection */
if ($mysqli->connect_errno) {
die('Connect failed: '.$mysqli->connect_error.'\n');
}
$sqlcolor = "SELECT * FROM farbe";
$statement = $mysqli->prepare($sqlcolor);
$statement->execute();
$result = $statement->get_result();
$colors;
while ($row = $result->fetch_object()) {
$colors[$row->id]=$row;
}
echo '<form action="table.php" method="get" width="300px">';
echo '<select name="farbe1">';
echo '<option value="0" ></option>';
foreach ($colors as $color) {
$hexbgcolor = sprintf("#%02x%02x%02x", $color->rot, $color->gruen, $color->blau);
$hextxtcolor = sprintf("#%02x%02x%02x", 255-$color->rot, 255-$color->gruen, 255-$color->blau);
echo '<option value="'.$color->id.'" style="background:'.$hexbgcolor.';color:'.$hextxtcolor.'">'.$color->name.'</option>';
}
echo '</select><br/>';
for ($i = 2; $i < 11; ++$i) {
echo '<select name="farbe'.$i.'">';
echo '<option value="0" ></option>';
foreach ($colors as $color) {
$hexbgcolor = sprintf("#%02x%02x%02x", $color->rot, $color->gruen, $color->blau);
$hextxtcolor = sprintf("#%02x%02x%02x", 255-$color->rot, 255-$color->gruen, 255-$color->blau);
echo '<option value="'.$color->id.'" style="background:'.$hexbgcolor.';color:'.$hextxtcolor.'">'.$color->name.'</option>';
}
echo '</select><br/>';
}
echo '<div class="checkbox"><label><input type="checkbox" name="aktiv" checked="checked">Aktive Korporationen</label></div>';
echo '<input type="submit" value="Suchen">';
echo '</form>';
include 'footer.php';
?>