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
| <?php
include_once("db_connection.php");
$tableau=array();
$sql = "SELECT * FROM base1";
$requete = mysql_query($sql);
$requete2="select item from menu1 where menu=1" ;
$resultat=mysql_query($requete2) or die(mysql_error());
while ($row= mysql_fetch_assoc($resultat))
{
$tableau[]=$row['item'];
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="Parc_Transformateur.css" />
<script class="jsbin" src="/release-builds/jquery.datatables.1.9.1.js"></script>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel= "stylesheet" href="media/css/demo_page.css"/>
<link rel= "stylesheet" href="media/css/demo_table.css"/>
<script type="text/javascript" language="javascript" src="media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="media/js/jquery.dataTables.js"></script>
<meta charset="utf-8" />
<?php include_once("menu_admin.php"); ?>
<title> </title>
</head>
<body id="dt_example">
<!-- tableau -->
<div align="center" >
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr >
<th >Num</th>
<th >Col2</th>
<th >Col3</th>
<th >Col4</th>
<th >Col5<th>
<th >Col6</th>
<th >Col7</th>
<th >Col8</th>
<th >Col9</th>
</tr>
</thead>
<tbody>
<?php //affichage des données:
while( $result = mysql_fetch_array( $requete ) )
{
echo '<tr style="background-color: #e5eeff" style="text-align: center;">
<td>'.$result['col1'].'</td>
<td>'.$result['col2'].'</td>
<td>'.$result['col3'].'</td>
<td>'.$result['col4'].'</td>
<td>'.$result['col5'].'</td>
<td>'.$result['col6'].'</td>
<td>'.$result['col7'].'</td>
<td>'.$result['col8'].'</td>
<td><select name="menu">';
foreach ($tableau as $element)
{
echo '<option value ="'. htmlspecialchars($element). '"">'.$element.'</option>';
}
echo '</select></td></tr>';
}
?>
<tbody>
</table>
</div>
</body>
<script type="text/javascript">
/*
* Example init
*/
$(document).ready(function(){
$('#example').dataTable();
});
</script>
</body>
</html> |
Partager