Voila, j'ai créer un tableau, dans celui j'affiche des valeur qui sont dans ma base. Je voudrai que si l'utilisateur le veux puisse modifier a partir de se tableau.
Mais voila, comme le tableau est créer dynamiquement, comment je fais pour connaitre le nom du champ ? Je ne fais peut être pas de la meilleur methode qui existe, mais je n'en voie pas d'autre.
Ma table s'appelle :
TABLEAU_PRIX
il y a comme champs :
CODE_TAB (PK)
PERIODICITE_SEM
TARIF
NUM_CONTRAT (FK)
<html>
<head>
<style type="text/css">
<!--
.Style1 {
font-family: Tahoma;
font-size: 24px;
}
.Style2 {
font-family: Tahoma;
font-size: 16px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="">
<?php
if(isset($_GET['mat']))
{$mat=$_GET['mat'];
}
if(isset($_GET['num']))
{$num=$_GET['num'];
}
if(isset($_GET['cop']))
{$cop=$_GET['cop'];
}
include_once("../../../connexion.php");
include_once("../../../fonction.inc.php");
?>
<p>
<?php
if ($cop==1)
{ ?>
<a href="consult_tarif.php?mat=<?php echo $mat ?>&num=<?php echo $num ?>&cop=<?php echo $cop ?>"><img src="../../../image/precedent.gif" width="41" height="25" border="0"></a>
<?php } else { ?>
<a href="consult_tarif.php?mat=<?php echo $mat ?>&num=<?php echo $num ?>&cop=<?php echo $cop ?>"><img src="../../../image/precedent.gif" width="41" height="25" border="0"></a>
<?php }
?>
</p>
<?php
$reqsql = mysql_query("SELECT COUNT( DISTINCT periodicite_sem) as period
FROM tableau_prix
where num_contrat='$num'");
while ($rep = @mysql_fetch_object($reqsql)) {
$sem = $rep->period;
$reqsql2 = mysql_query("SELECT COUNT( DISTINCT superficie) as super
FROM tableau_prix
where num_contrat='$num'");
while ($rep2 = @mysql_fetch_object($reqsql2)) {
$sup = $rep2->super;
?>
<table width="70%" border="1" align="center" >
<tr>
<td width="7%" align="center" valign="middle"></td>
<?php
$reqsql4 = mysql_query("SELECT periodicite_sem
from tableau_prix
where num_contrat='$num'
group by periodicite_sem");
while ($rep4 = @mysql_fetch_object($reqsql4)) {
$perio = $rep4->periodicite_sem;
?>
<td width="7%" align="center" >
<?php echo $perio ?></td>
<?php
}
?>
</tr>
<?php
$reqsql3 = mysql_query("SELECT superficie
from tableau_prix
where num_contrat='$num'
group by superficie");
while ($rep3 = @mysql_fetch_object($reqsql3)) {
$super = $rep3->superficie;
?>
<tr>
<td align="center" valign="middle"><?php echo '< '.$super ?></td>
<?php
$reqsql6 = mysql_query("SELECT periodicite_sem
from tableau_prix
where num_contrat='$num'
group by periodicite_sem");
while ($rep6 = @mysql_fetch_object($reqsql6)) {
$periode = $rep6->periodicite_sem;
$reqsql5 = mysql_query("SELECT tarif
from tableau_prix
where num_contrat='$num'
and periodicite_sem='$periode'
and superficie='$super'");
while ($rep5 = @mysql_fetch_object($reqsql5)) {
$tarif = $rep5->tarif;
?>
<td align="center" >
<input name="<?php $super.'-'.$periode ?>" type="text" id="<?php $super.'-'.$periode ?>" align="texttop" value="<?php echo $tarif ?>" size="6" maxlength="6"></td>
<?php
}
}
?>
</tr>
<?php
}
?>
</table>
<?php
}
}
?>
<p> </p>
<div align="center"><a href="untitled.php?mat=<?php echo $num ?>"><img src="../../../image/bouton/button2D.gif" width="115" height="23" border="0" ></a></img>
</div>
</form>
</boby>
</html>
j'espère que vous m'avez compris et que vous allez pouvoir m'aidermerci d'avance