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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| <!DOCTYPE html>
<html>
<head>
<style>
table {
width:50%;
}
table tr:nth-child(even) {
background-color: #FAD7A0;
}
table tr:nth-child(odd) {
background-color:#fff;
}
table th {
background-color: #F39C12;
color: white;
}
input[type=submit] {
width: 50%;
background-color: #F39C12;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #9C640C;
}
body {
padding: 20px;
}
label{
margin-left:20px;
display:block;
width:80px;
float:left;
}
</style>
</head>
<body>
<form action="test2.php">
<input type="submit" value="Validation">
</form>
<label for="id">Vendor</label>
<label for="idzone">Zone</label>
<?php
$conn = new mysqli('localhost', 'root', '', 'slots')
or die ('Cannot connect to db');
$result = $conn->query("select id, vendor from tvendor");
echo "<select name='id'>";
while ($row = $result->fetch_assoc()) {
unset($id, $vendor);
$id = $row['id'];
$vendor = $row['vendor'];
echo '<option value="'.$id.'">'.$vendor.'</option>';
}
echo "</select>";
$result2 = $conn->query("select idzone, zone from tzone");
echo "<select name='idzone'>";
while ($row = $result2->fetch_assoc()) {
unset($idzone, $zone);
$idzone = $row['idzone'];
$zone = $row['zone'];
echo '<option value="'.$idzone.'">'.$zone.'</option>';
}
echo "</select>";
?>
</body>
</html> |
Partager