Bonjour,
Je génère un tableau contenant les 3 données d'une de mes tables.
- Horizontalement j'ai mon produit ("ia") ;
- Verticalement, les mois ;
- les cellules représentent la valeur d'un produit pour un mois donné.
Je veux pourvoir modifier les valeurs et tou sauvegarder d'un coup.
Comment récupérer toutes les valeurs pour les enregistrer dans ma base.
Car pour le moment, je n'ai en sortie que la dernière valeur de mon tableau.
Je vous remercie par avance.
cdt
Voici le code :
<html>
<head>
<link rel="stylesheet" type="text/css" href="../../css/styles.css">
<?php
include("../../inc/_connection.php");
?>
</head>
<body>
<form name="form_add" method="post" action="reporting_add.php">
<input type="submit" value="save">
<table width="100%" cellpadding="0" cellspacing="1" border="0" class="td_small">
<tr>
<td width="100%">
<?php
function getscores() {
$notes = array();
$query = mysql_query("SELECT ia, month, value FROM tbl_fteia ORDER BY month, ia ASC");
while ($note = mysql_fetch_array($query)) {
$notes[$note['month']][$note['ia']]=$note['value'];
}
return $notes
}
?>
<table width="0" cellpadding="3" cellspacing="3" border="0">
<tr>
<td> </td>
<?php
foreach($notes as $month=>$month_notes) {
?>
<td width="40" align="center">
<?php
if ($month == 1) { $month = 'jan'; }
if ($month == 2) { $month = 'feb'; }
if ($month == 3) { $month = 'mar'; }
if ($month == 4) { $month = 'apr'; }
if ($month == 5) { $month = 'may'; }
if ($month == 6) { $month = 'jun'; }
if ($month == 7) { $month = 'jul'; }
if ($month == 8) { $month = 'aug'; }
if ($month == 9) { $month = 'sep'; }
if ($month == 10) { $month = 'oct'; }
if ($month == 11) { $month = 'nov'; }
if ($month == 12) { $month = 'dec'; }
echo $month;
?>
</td>
<?php
}
?>
</tr>
<?php
foreach(reset($notes) as $ia=>$n) {
$query_list_ia = mysql_query("SELECT name FROM tbl_ia WHERE id = $ia");
$retrieval_list_ia = mysql_fetch_array($query_list_ia);
?>
<tr>
<td width="70" class="fviolet_pgrasse">
<?php
echo stripslashes(htmlentities($retrieval_list_ia['name']));
?>
</td>
<?php
foreach($notes as $month=>$month_notes) {
?>
<td align="center">
<input name="ia" type="hidden" value="<?php echo $ia; ?>">
<input name="month" type="hidden" value="<?php echo $month; ?>">
<input name="value" type="text" class="zdt_04" value="<?php echo $month_notes[$ia]; ?>">
</td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>