bonjour a tous,
voila j'avais deja posé des questions sur ce sujet et je pensais que mon programme marchait mon non.
En fait, je voudrai utiliser la fonction implode seulement sur une ligne de mon tableau???
Voila le code:
$nbcolumns=$JourMax;
$nblignes=5 + $_SESSION['ajout_ligne'];
$sums_col=array_fill(1,$nbcolumns,0);
$sums_lig=array_fill(1,$nblignes,0);
foreach ($calendrier as $i=>$val) {
$sums_col[1+($i%$nbcolumns)] += $val;
$sums_lig[1+floor($i/$nbcolumns)] += $val;
}
for ($k=1; $k<=$nblignes; $k++){
$valOS='';
if (!empty($_POST['case_os'][$k-1]))
$valOS=' value="'.$_POST['case_os'][$k-1].'"';
$valLib='';
if (!empty($_POST['case_libelle'][$k-1]))
$valLib=' value="'.$_POST['case_libelle'][$k-1].'"';
if ((!empty($_POST['case_os'][$k-1])) && (!empty($_POST['case_libelle'][$k-1]))){
$sql1 = 'INSERT INTO formules (id,valOS,valLib,dateSel) VALUES(\'\',\''.$_POST['case_os'][$k-1].'\',\''.$_POST['case_libelle'][$k-1].'\',\''.$date2.'\')';
$req1 = mysql_query($sql1) or die('erreur de modification1');
}
echo '<tr>
<td width="6%" >
<a href="javascript:popup(\'os.php\')">OS :</a>
<input name="case_os[]" type="text" id= "case_os[]" size="5"'.$valOS.'>
</td>
<td width="7%">
<a href="javascript:popup(\'libelles.php\')">Libelles :</a>
<input name="case_libelle[]" type="text" size="9" maxlength="15"'.$valLib.'>
</td>';
// affichage des textbox où l'utilisateur remplit les temps de travail
for($l=1; $l<=$JourMax; $l++){
$val='';
if (!empty($calendrier[$i-1]))
$val='value="'.$calendrier[$i-1].'"';
echo '<td width="6%">
<input name="calendrier[]" type="text" size="1" maxlength="4"'.$val.'>
</td>';
$i++;
}
echo '<td>'.$sums_lig[$k].'</td>';
}
echo '<tr><td colspan="2"></td>';
//affichage du total par colonne
foreach ($sums_col as $key => $value) {
if ($value>1)
echo '<td bgcolor="#FF0000">'.$value.'</td>';
else
echo '<td>'.$value.'</td>';
}
echo '<td>'.array_sum($calendrier).'</td>';
?></tr></table>
<input name="valider_calendrier" type="submit" value="envoyer"/>
Je vous remercie d'avance.