form created

This commit is contained in:
Adrian Amaglio 2018-03-27 08:46:52 +02:00
parent 1f07f7d3fb
commit 74a5b5375b

View File

@ -14,6 +14,14 @@ file_get_contents(
), ),
true true
); );
if(isset($_GET['filter'])){
if(htmlentities($_GET['filter']))
$filter = true;
else
$filter = false;
}else
$filter = false;
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -35,13 +43,35 @@ file_get_contents(
</style> </style>
</head> </head>
<body> <body>
<table> <form action="" method="get">
<tr><th>Nom</th><th>Vélos</th><th>Places Libres</th></tr> <?php if ($filter) { ?>
<?php <input type="hidden" name="filter" value="" />
foreach ($data as $station){ <input type="submit" value="Tout afficher" />
echo '<tr><td class="', ($station['open'] == 1 || $station['obsolete'] == 0 ? 'success' : 'danger' ) ,'" >',$station['name'], '</td><td>',$station['AB'], '</td><td>', $station['ABS'], '</td></tr>'; <?php } else { ?>
} <input type="hidden" name="filter" value="true" />
?> <input type="submit" value="Afficher uniquement la séléction" />
</table> <?php } ?>
<table>
<tr><th>Sélectionner</th><th>Nom</th><th>Vélos</th><th>Places Libres</th></tr>
<?php
foreach ($data as $key => $station){
echo
'<tr>
<td><input type="checkbox" name="',$key,'"/></td>
<td class="', ($station['open'] == 1 && $station['obsolete'] == 0 ? 'success' : 'danger' ) ,'" >'
,$station['name'],
'</td>
<td>',$station['AB'], '</td>
<td>', $station['ABS'], '</td>
</tr>';
}
?>
</table>
<?php if ($filter) { ?>
<input type="submit" value="Tout afficher" />
<?php } else { ?>
<input type="submit" value="Afficher uniquement la séléction" />
<?php } ?>
</form>
</body> </body>
</html> </html>