filtrer avec la date et figer les résultats après modification
Bonjour, j'ai une page qui me permet d'afficher les données enregistrées dans ma base entre deux dates afin de modifier la colonne sig,
la problématique est que je peux me retrouver avec 10 lignes à modifier, et lorsque je modifie la première ligne je suis obligé chaque fois retaper les dates pour retrouver les résultats , comment je peux faire pour que lorsque la modification est effectué, je revienne sur le même affichage ?
Code:
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
| <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<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>
</head>
<body>
<?php include_once("menu_admin.php");?>
<div align="center">
<div align="center">
<!-- formulaire -->
<form name="formulaire" method="post" enctype="multipart/form-data" action="modification.php">
<td width="500"><font size=3><b> Saisir les dates :</b></font></td>
<label> <strong> Début (*) : </strong> </strong> </label>
<input name="datedebut" type="text" size="30"/> </br>
<label> <strong> Fin (*) : </strong> </label>
<input name="datefin" type="text" size="30"/></br></br>
<input type="submit" value="Envoyer" name="envoyer">
</form>
</div>
<?php
include_once("db_connection.php");
if(isset($_POST["envoyer"]))
{
$date1=date_create_from_format('d/m/Y',$_POST["datedebut"]);
$date2=date_create_from_format('d/m/Y',$_POST["datefin"]);
if ($date1 && $date2) {
$sql = "SELECT * FROM installation
WHERE journee BETWEEN '" . $date1->format('Y-m-d') . "' AND '" . $date2->format('Y-m-d') . "'";
$sql1 = "SELECT * FROM transformateur
WHERE journee BETWEEN '" . $date1->format('Y-m-d') . "' AND '" . $date2->format('Y-m-d') . "'";
$requete = mysql_query($sql);
$requete1 = mysql_query($sql1);
}
else {
echo 'Dates erronées';
}
?>
<!-- tableau -->
<body id="dt_example">
<!-- tableau -->
<div align="center" >
<p color="red"><strong> PARC INSTALLATION</strong></p>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr >
<th> Identifiant</th>
<th> Type</th>
<th> P(kVA)</th>
<th> Commune</th>
<th> Code GDO</th>
<th> Date Réalisation </th>
<th> Entreprise </th>
<th> Statut </th>
<th> SIG </th>
</tr>
</thead>
<tbody>
<?php //affichage des données:
while( $result = mysql_fetch_array( $requete ) )
{
?>
<?php $journee=$result["journee"];
list($annee, $jour, $mois)=explode ('-',$journee);
$journeef=date("d/m/Y", mktime(0,0,0,$jour,$mois,$annee));
$checked =(($result["identifiant"] =="" ) ? "" : "checked");
?>
<tr style="background-color: #e5eeff" style="text-align: center;">
<td><?php echo $result['identifiant']; ?></td>
<td><?php echo $result['type']; ?></td>
<td><?php echo $result['puissance']; ?></td>
<td><?php echo $result['nom']; ?></td>
<td><?php echo $result['gdo']; ?></td>
<td><?php echo $journeef; ?></td>
<td><?php echo $result['entreprise']; ?></td>
<td><?php echo $result['choix']; ?></td>
<td><a href="siginstallation.php?idtrt=<?php echo $result['id']; ?>"><?php echo $result['sig']; ?></a></td>
</tr>
<?php
}
?>
<tbody>
</table>
</div>
<body id="dt_example">
<div align="center" >
<p color="red"><strong> MAGASIN</strong></p>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr >
<th> Identifiant</th>
<th> Type</th>
<th> P(kVA)</th>
<th> Commune</th>
<th> Code GDO</th>
<th> Date Réalisation </th>
<th> Entreprise </th>
<th> Zone </th>
<th> SIG </th>
</tr>
</thead>
<tbody>
<?php //affichage des données:
while( $result = mysql_fetch_array( $requete1 ) )
{
?>
<?php $journee=$result["journee"];
list($annee, $jour, $mois)=explode ('-',$journee);
$journeef=date("d/m/Y", mktime(0,0,0,$jour,$mois,$annee));?>
<tr style="background-color: #e5eeff" style="text-align: center;">
<td><?php echo $result['identifiant']; ?></td>
<td><?php echo $result['marque']; ?></td>
<td><?php echo $result['puissance']; ?></td>
<td><?php echo $result['nom']; ?></td>
<td><?php echo $result['gdo']; ?></td>
<td><?php echo $journeef; ?></td>
<td><?php echo $result['entreprise']; ?></td>
<td><?php echo $result['zone']; ?></td>
<td><a href="sigtransformateur.php?idtrt=<?php echo $result['identifiant']; ?>"><?php echo $result['sig']; ?></a></td>
</tr>
<?php
}
}
?>
<tbody>
</table>
</div>
<script type="text/javascript">
/*
* Example init
*/
$(document).ready(function(){
$('#example').dataTable();
});
</script>
</body>
</html> |