Récupérer l'url de la page précédente

LiLou LiLa Messages postés 330 Statut Membre -  
 JuB0 -
Bonjour,
je travaille sur plusieurs formulaires ayant des liens entre eux
plusieurs peuvent acceder a une page qui a un bouton retour
et jaimerai que ce bouton retour ramene a la page d'avant , donc suivant d ou on vient d ou l utilité de recuperer l url de la page davant
je pense utiliser les sessions
jai trouvé sur des sites
$nom_fichier = basename($_SERVER['HTTP_REFERER']);
$nom_fichier = basename($_SERVER['REQUEST_URI']);

mais ça ne marche pas vraiment ou du moins je l utilise peut etre mal
aidez moi svp a regler ce petit probleme ça me bloque un peu en ce moment
merci d avance
A voir également:

63 réponses

LiLou LiLa Messages postés 330 Statut Membre 12
 
jsuis pas feignante :p jfais des heures supp normalement je finis a 16h :p
disons que les variables sont un peu plus complexes que ça :) :
pcq les fiches materiel et reparation elles souvrent soit en mode consultation soit en modification
et elles suivent le numero que t'as choisi avant dans une recherche sur le materiel ou la reparation que tu veux :)
0
Anonimus
 
Mets des bouts de ton code des différentes pages ;)
Le pire c'est que ton problème est simple à résoudre seulement j'ai un peu de mal là :D
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
dison qu il y a un peu de tout partout ^^
des bouts de code de toutes mes pages :o ? ? ?
tu sias que chacune de mes pages font au moins 400 lignes :s
0
Anonimus
 
Ce n'est pas grave j'ai tout mon temps... en stage je fou rien. :s
Au pire mets tes pages en ligne que je puisse les DL.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
LiLou LiLa Messages postés 330 Statut Membre 12
 
jsais pas faire ^^
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
jte copie/colle après mangé ya personne ils picolent tous donc jaurais le temps de te le faire comme il faut maniere de pas de copie/colle des milliers de lignes de codes :p
0
Anonimus
 
Dépose ça là : http://www.megaupload.com/fr/

Tu fais parcourir, tu mets le fichier (mets tes pages dans un fichier compressé .zip et .rar).
Ensuite tu accepte les conditions.
Il va uploader ton fichier et une fois fini tu va avoir un lien qui clignote, colle le ici ;)

PS : Y'aura sans doute des photos de filles une fois le fichier en ligne... n'en prend pas cas lol :D
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
mué jprefere te mettre les trucs là c'est ma planque jsuis controlee ici ;o
0
Anonimus
 
Mais en fait tu fais quoi en stage ?
Le site de ton entreprise ?
Un intranet ?
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
ué un intranet chez des pompiers :p
le site avait dejà eté commencé par la stagiaire de lannée derniere
moi je continue , je decouvre ces fonctions et maniere decrire et je dois faire pareil et continuer son boulot et parfois rectifier ces conneries :)
0
Anonimus
 
Chez les pompiers... un fantasme ? :D
Et tu fais quoi comme études ?
(Quand j'te dis que je fou vraiment rien... :D)
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
oh tu sais bien luniforme .. :p
jsuis arrivée ici par pur hasard je leur ai ecris sans savoir qui cetait (sdis = pompier ?! ) et voilà je me plains pas je suis bien entourée
jsuis en bts informatique de gestion et toi?
(dsl du retard il regardait mon code ^^)
0
Anonimus
 
Lol, ils s'y connaissent les pompiers en code ? Oo
Moi aussi je suis en BTS IG, je viens de finir ma première année et je vais en 2ème année développeur. :)

Bon je vais allez manger, n'oublie pas de mettre ton code ;) (Quand il y aura personne et qu'ils picoleront... des pompiers qui picolent oO)
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
pareil jpasse en 2eme année en developpement :p
ué ils ont un service info et ils sy connaissent plus que moi :) (bien que ce ne soit pas difficile.. )
ué ils picolent ya un anniversaire donc jserais tranquille :)
(jsuis mm pas invité :'( )
a tout al heure bon app ;)
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
PARTIE REPARATION :</gars>
(allons directement a la page concernée)
->fichereparation.php
<html>
<head><title>fiche de réparation</title><script src="fonction.js"></script></head>

<body onload="form.prochent.disabled=true">

<?

include_once("confsite.php");

session_start();

//Connexion aux bases de données

$Connexion=Connecte(*******,$_SESSION['nom'],$_SESSION['passe']);

$Connexion2=Connecte(*************,$_SESSION['nom'],$_SESSION['passe']);



//Récupère le type d'action sur la fiche (ajout,modification,consultation)

$mode=$_GET['mode'];



if(isset($_GET['type']))//Cas des consultations des anciennes réparations a partir d'une reparation
	$type=$_GET['type'];

?>



<script langage="javascript">

function ouv_affectation(){window.open("listeaffectation.php","","width=700,height=400,left=320,top=0,scrollbars=yes");}

function ouv_reparation(){window.open("listerepanc.php","","width=720,height=400,left=320,top=0,scrollbars=yes");}
function recopie_prix(numero,prix){var texte="document.form.prix" + numero + ".value=" + prix;eval(texte);}
</script>



<form method="post" action="enregistrerfiche.php" name="form" id="form">

<table width=100%>

<tr><?//Titre et lien ancre?>

  <th width=50%>

    <fieldset>

    <div align="center" class="soustitre">FICHE REPARATION ET ENTRETIEN

    <?  //état de la fiche (en cours ou cloturée)

    $sql="SELECT datecloture_RE

          FROM REPARATION_ET_ENTRETIEN

          WHERE Id_RE='".$_SESSION['ID']."';";

    $datecloture=ValChamp($Connexion,$sql);

	//nouveau code $datecloture

    if(($datecloture=='')||($datecloture=='//'))

    {

    	echo "(en cours)";

    	$etat="encours";

    }

    else

    {

    	echo "(clôturée)";
	//nouveau code : supprimer $mode="consultation"
     	$etat="cloturee";
    }

    ?>



    </div>

    </fieldset>

    </th>

    <td>

    <p>

    <A HREF="#bas"> Aller en bas de la fiche </A>

    </td>

</tr>

<tr>

    <td colspan=4 align="center">

    &nbsp

    <? //Numéro et date de la fiche

    echo " Numéro : ".$_SESSION['ID']." &nbsp &nbsp ";

    echo " Date : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT CONVERT(VARCHAR(2),DAY		(REPARATION_ET_ENTRETIEN.Date_RE)) +'/'+ CONVERT(VARCHAR(2),MONTH(REPARATION_ET_ENTRETIEN.Date_RE)) +'/'+ CONVERT(VARCHAR(4),YEAR(REPARATION_ET_ENTRETIEN.Date_RE))

 FROM REPARATION_ET_ENTRETIEN WHERE Id_RE='".$_SESSION['ID']."'")."\" name=\"date\">";

     //Moyen

     echo " -  Moyen : ";

     $selection=ValChamp($Connexion,"SELECT Libellecourt_MOY

                                     FROM REPARATION_ET_ENTRETIEN,MOYEN

                                     WHERE REPARATION_ET_ENTRETIEN.Id_MOY=MOYEN.Id_MOY

                                     AND Id_RE='".$_SESSION['ID']."'");

     $sql="SELECT Id_MOY,Libellecourt_MOY

           FROM MOYEN";

     $resultat=resultat($sql,$Connexion);

     ListeOption($resultat,1,"moyen",1,$selection);  
     ?>

  <p>

  <? //Sigle de la fiche

     echo " Sigle : ";

     $selection=ValChamp($Connexion,"SELECT Libellecourt_STM+' '+convert(varchar(20),Numordre_M)

                                     FROM REPARATION_ET_ENTRETIEN,MATERIEL,SOUS_TYPE_MATERIEL

                                     WHERE REPARATION_ET_ENTRETIEN.Id_M=MATERIEL.Id_M

                                     AND MATERIEL.Id_STM=SOUS_TYPE_MATERIEL.Id_STM

                                     AND Id_RE='".$_SESSION['ID']."'");

     $sql="SELECT Id_M,Libellecourt_STM+' '+convert(varchar(20),Numordre_M)

           FROM MATERIEL,SOUS_TYPE_MATERIEL

           WHERE MATERIEL.Id_STM=SOUS_TYPE_MATERIEL.Id_STM ORDER BY (Libellecourt_STM+' '+convert(varchar(20),Numordre_M))";

     $resultat=resultat($sql,$Connexion);

     ListeOption($resultat,1,"sigle",1,$selection);

     echo " &nbsp &nbsp ";

    //Immatriculation de la fiche

     echo " Immatriculation : ".ValChamp($Connexion,"SELECT Immatriculation_M

                                                            FROM REPARATION_ET_ENTRETIEN,MATERIEL

                                                            WHERE REPARATION_ET_ENTRETIEN.Id_M=MATERIEL.Id_M

                                                            AND Id_RE='".$_SESSION['ID']."'");

    //mise en circulation

     echo " Mise en Circu. : ".ValChamp($Connexion,"SELECT convert(char(10),Misecirculation_M,103)

                                                            FROM REPARATION_ET_ENTRETIEN,MATERIEL

                                                            WHERE REPARATION_ET_ENTRETIEN.Id_M=MATERIEL.Id_M

                                                            AND Id_RE='".$_SESSION['ID']."'");  
  ?>

  <p>

  <? //Marque et Model de la fiche

     echo " Modèle : ". ValChamp($Connexion,"SELECT Libelle_MA

                                                     FROM REPARATION_ET_ENTRETIEN,MATERIEL,MARQUE

                                                     WHERE REPARATION_ET_ENTRETIEN.Id_M=MATERIEL.Id_M

                                                     AND MATERIEL.Id_MA=MARQUE.Id_MA

                                                     AND Id_RE='".$_SESSION['ID']."'");

     echo " / ".ValChamp($Connexion,"SELECT Model_M

                                     FROM REPARATION_ET_ENTRETIEN,MATERIEL

                                     WHERE REPARATION_ET_ENTRETIEN.Id_M=MATERIEL.Id_M

                                     AND Id_RE='".$_SESSION['ID']."'");

     echo " -  Equipement pal : ". ValChamp($Connexion,"SELECT Libelle_MA

                                                     FROM REPARATION_ET_ENTRETIEN,MATERIEL,MARQUE

                                                     WHERE REPARATION_ET_ENTRETIEN.Id_M=MATERIEL.Id_M

                                                     AND MATERIEL.Id_MA_Equip=MARQUE.Id_MA

                                                     AND Id_RE='".$_SESSION['ID']."'");

  ?>

  <p>

  <? //Km

     echo " Km : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT Km_RE

                                                                     FROM REPARATION_ET_ENTRETIEN

                                                                     WHERE Id_RE='".$_SESSION['ID']."'")."\" name=\"km\"> &nbsp &nbsp ";

     echo " Heures : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT Heure_RE

                                                                     FROM REPARATION_ET_ENTRETIEN

                                                                     WHERE Id_RE='".$_SESSION['ID']."'")."\" name=\"hm\"> &nbsp &nbsp ";
	//nouveau code ajout heure pompe 
     echo " Heures pompes : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT HeurePompe_RE
									FROM REPARATION_ET_ENTRETIEN
									WHERE Id_RE='".$_SESSION['ID']."'")."\"name=\"hp\">";
  ?>

  <p>

  </td>

</tr>

</table>

<table width=100%>

<tr><?//boutons reparations precedentes, prochains entretiens et affectations?>
<?if(!isset($type))//Cas des consultations des anciennes réparations a partir d'une reparation

{

    echo "<td align=\"center\">";

    echo "<input type=\"button\" value=\"REPARATIONS DU MATERIEL\" onClick=\"ouv_reparation()\" class=\"bouton_form2	\">";

    echo "</td>";

    echo "<td align=\"center\">";

    echo "<input type=\"button\" value=\"PROCHAINS ENTRETIENS\" name=\"prochent\" onClick=\"self.location.href='fichereparation.php?mode=".$mode."'\" class=\"bouton_form2\">";

    echo "</td>";

    echo "<td align=\"center\">";

    echo "<input type=\"button\" value=\"AFFECTATIONS DU MATERIEL\" onClick=\"ouv_affectation()\" class=\"bouton_form2\">";

    echo "</td>";

}

?>

</tr>

</table>

<div class=soussoustitre>
Main d'oeuvre

</div>


  <? //Main d'oeuvre

     //Tableau des personnes ayant participé à la réparation

     $sql="SELECT Id_p,Heure_P_RE,Minute_P_RE,Astreinte_P_RE

           FROM TRAVAIL_PERSONNEL,REPARATION_ET_ENTRETIEN

           WHERE TRAVAIL_PERSONNEL.Id_RE=REPARATION_ET_ENTRETIEN.Id_RE

           AND REPARATION_ET_ENTRETIEN.Id_RE='".$_SESSION['ID']."'

           ORDER BY Id_p DESC";

     $resultat = resultat($sql,$Connexion);

     //Affiche le tableau

     TableauPersonnel($resultat,4,$Connexion2,"Nom et Prénom","Temps passé","Astreinte");



     //Affiche les boutons ajouter et supprimer//nouveau code &&($etat=="encours")

     if (($mode=="modification")&&($etat=="encours"))

     { echo "<table width=100%><tr><td align=\"right\"><input type=\"submit\" value=\"AJOUTER LIGNE\" name=\"AJOUTP\"  class=\"bouton_form2\">";

       echo "<input type=\"submit\" value=\"SUPPRIMER LIGNE\" name=\"SUPPRIMP\" class=\"bouton_form2\" ></td></tr></table><p>";

     }

  ?>

<div class=soussoustitre>
Travaux
</div>
  <? //Requête sélection des travaux de la fiche

     $sql="SELECT Id_DR,Observation_DR,Libellecourt_TRE

           FROM DETAIL_REPARATION,TYPE_REPARATION_ET_ENTRETIEN,REPARATION_ET_ENTRETIEN

           WHERE DETAIL_REPARATION.Id_TRE=TYPE_REPARATION_ET_ENTRETIEN.Id_TRE

           AND DETAIL_REPARATION.Id_RE=REPARATION_ET_ENTRETIEN.Id_RE

           AND REPARATION_ET_ENTRETIEN.Id_RE='".$_SESSION['ID']."'

           ORDER BY Id_DR";

     $resultat = resultat($sql,$Connexion);

     //Requête liste de tout les types pour la liste déroulante

     $sqlliste="SELECT Id_TRE,Libellecourt_TRE

                FROM TYPE_REPARATION_ET_ENTRETIEN";

     //Affiche le tableau

     echo tableaumodif($resultat,3,$sqlliste,$Connexion,"2 type","observation type","Observation","Type");

     //Affiche les boutons ajouter et supprimer//nouveau code &&($etat=="encours")

     if (($mode=="modification")&&($etat=="encours"))

     { 

       echo "<table width=100%><tr><td align=\"right\"><input type=\"submit\" value=\"AJOUTER LIGNE\" name=\"AJOUTT\"  class=\"bouton_form2\">";

       echo "<input type=\"submit\" value=\"SUPPRIMER LIGNE\" name=\"SUPPRIMT\" class=\"bouton_form2\"></td></tr></table><p>";

     }

  ?>

<div class=soussoustitre>
Pièces et fournitures
</div>

  <?
   //Requête pour l'affichage des produits de la fiche

     $sql="SELECT Id_BP,Ref_PF+' '+Libelle_PF,Ref_PF,Libelle_BP,Qtesortie_BP,PUnet_BP,Id_F

           FROM PIECE_ET_FOURNITURE,BESOIN_PIECE,REPARATION_ET_ENTRETIEN

           WHERE PIECE_ET_FOURNITURE.Id_PF=BESOIN_PIECE.Id_PF

           AND BESOIN_PIECE.Id_RE=REPARATION_ET_ENTRETIEN.Id_RE

           AND REPARATION_ET_ENTRETIEN.Id_RE='".$_SESSION['ID']."'

           ORDER BY Id_BP";

     $resultat = resultat($sql,$Connexion);

     //Requête liste de tous les produits pour la liste déroulante

     $sqlliste="SELECT Id_PF,PIECE_ET_FOURNITURE.Ref_PF+' '+ Libelle_PF,Prixachat_PF

                FROM PIECE_ET_FOURNITURE ORDER BY PIECE_ET_FOURNITURE.Ref_PF";

     //Affiche le tableau

     echo tableaupiece($resultat,5,$sqlliste,$Connexion,"1 produit","reference libelle quantite prix fournisseur","Référence et Libellé","Libellé Autre","Quantité","PU HT");

     //Affiche les boutons ajouter et supprimer//nouveau code &&($etat=="encours")

     if (($mode=="modification")&&($etat=="encours"))

     {

       echo "<table width=100%><tr><td align=\"right\"><input type=\"submit\" value=\"AJOUTER LIGNE\" name=\"AJOUTPI\"  class=\"bouton_form2\">";

       echo "<input type=\"submit\" value=\"SUPPRIMER LIGNE\" name=\"SUPPRIMPI\" class=\"bouton_form2\"></td></tr></table><p>";

     }

  ?>

<div class=soussoustitre>
  Observations :
</div>
<table width=100%><?//Observation?>

<tr>

<td align="center">

  <? //Champ observation

     echo "<textarea cols=60 rows=5 name=\"obs2\">".ValChamp($Connexion,"SELECT Observation_RE

                                                                         FROM REPARATION_ET_ENTRETIEN

                                                                         WHERE REPARATION_ET_ENTRETIEN.Id_RE='".$_SESSION['ID']."'")."</textarea>";

  ?>

</td>

</tr>

</table>

<div align="center">

    <?

    //Affiche des données globales de la fiche

    echo "<div align=\"center\">";

    resume($_SESSION['ID']);

    echo "</div>";

if(!isset($type))//Cas des consultations des anciennes réparations a partir d'une reparation en else

{

    if(droit(4,$_SESSION['nom'])=='oui')//Affiche le bouton imprimer si le droit est accordé

    {

   	echo "<input type=\"submit\" value=\"IMPRIMER\" name=\"IMP\" > ";

    }
//nouveau code if &&

    if(($mode=="modification")&&($etat=='encours')&&(droit(3,$_SESSION['nom'])=='oui'))//Affiche le bouton si en mode modification

    {

   	echo "<input type=\"submit\" value=\"ENREGISTRER\" name=\"ENREGISTRER\"> ";

    }

   /* if($_SESSION['sql']=='')

    {

    	echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='gestionreparation.php'\" name=\"2\">";

    }

    else

    {

    	echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='resultatreparation.php'\" name=\"2\">";

    }*/
	
	<gras>if ((basename($_SERVER['HTTP_REFERER']))==("fichereparation.php"))
		{echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='fichereparation.php'\" name=\"2\">";}
	else
		{echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='fichemateriel.php'\" name=\"2\">";}
//nouveau code
$sql="SELECT CONVERT(VARCHAR(2),DAY(datecloture_RE)) +'/'+ CONVERT(VARCHAR(2),MONTH(datecloture_RE)) +'/'+ CONVERT(VARCHAR(4),YEAR(datecloture_RE)) FROM REPARATION_ET_ENTRETIEN WHERE Id_RE='".$_SESSION['ID']."';";

$datecloture=ValChamp($Connexion,$sql);
if(($datecloture!='')&&($datecloture!='//'))
	echo "<br><br>Fiche cloturee le $datecloture";
if($mode=="modification")

{
	if ($etat=="encours")
	{
		if(droit(22,$_SESSION['nom'])=='oui')
		{
			 $sql="SELECT Id_N from UTILISATEUR where Nom_U='".$_SESSION['nom']."';";

   			 $niveau=ValChamp($Connexion,$sql);

    			 $sql="SELECT MAX(Niveau_TRE)

          		 FROM TYPE_REPARATION_ET_ENTRETIEN,REPARATION_ET_ENTRETIEN,DETAIL_REPARATION

          		 WHERE TYPE_REPARATION_ET_ENTRETIEN.Id_TRE=DETAIL_REPARATION.Id_TRE

          		 AND DETAIL_REPARATION.Id_RE=REPARATION_ET_ENTRETIEN.Id_RE

          		 AND DETAIL_REPARATION.Id_RE='".$_SESSION['ID']."';";

    			 $mini=ValChamp($Connexion,$sql);

    			 if($mini=='')$mini=0;

    			 if($niveau>=$mini)//Si niveau suffisant pour modifier une clôturée

    			 {

     				 $date=date("j n Y", time());

      				 $tableau=explode(' ',$date);

      				 $date=$tableau[0]."/".$tableau[1]."/".$tableau[2];

     				 echo "<p><input type=\"text\" value=\"".$date."\" name=\"datecloture\">";

      				 echo "<input type=\"submit\" value=\"CLOTURER\" name=\"CLOTURER\">";
			 }

  		}

  	 }
	else //$etat=="cloturee"
	{
		if(droit(5,$_SESSION['nom'])=='oui')

 		{
			echo "<br><br>Modifier la fiche cloturee :<input type=\"text\"  value=\"".$datecloture."\" 				name=\"datecloture\"><br><br>";
	 		echo "<input type=\"submit\" value=\"MODIFIER LA FICHE CLOTUREE\" name=\"MODIFIER\" 				class=\"bouton_form\"> ";

    		}

        }
}
}

else //Cas des consultations des anciennes réparations a partir d'une reparation

{
	
	if ((basename($_SERVER['HTTP_REFERER']))==("fichereparation.php"))
		echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='fichereparation.php'\" name=\"2\">";
	else
		echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='fichemateriel.php'\" name=\"2\">";

}//onClick=\"self.location.href=\"

?>

<A NAME="bas">

</div>

</form>

</body>

</html>


FICHE MATERIEL
<html>

<head>

<title>fiche matériel</title>
<script src="fonction.js"></script>

</head>

<body onload="form.prochent.disabled=true">

<?

include_once("confsite.php");

session_start();

//Connexion aux bases de données

$Connexion=Connecte(*******,$_SESSION['nom'],$_SESSION['passe']);

$Connexion2=Connecte(****************,$_SESSION['nom'],$_SESSION['passe']);



if($mode=$_GET['mode'])//Récupère le type d'action sur la fiche (ajout,modification,consultation)

	$mode=$_GET['mode'];

if(isset($_GET['type']))//Cas des consultations des anciennes réparations a partir d'une reparation
	$type=$_GET['type'];

?>

<form method="post" action="enregistrerfiche.php" name="form" id="form">

<table width=100%>

<tr>

  <th width=50%>

    <fieldset>

    <div align="center" class="soustitre">
	FICHE MATERIEL

    </div>

    </fieldset>

  </th>

  <td>

    <p>

    <A HREF="#bas"> Aller en bas de la fiche </A>

  </td>

</tr>

<tr>

  <td colspan=4 align="center">

  &nbsp

  <?
 //Affiche ID sigle Type non modifiable
	$text1="SELECT Libellecourt_STM+' '+convert(varchar(20),Numordre_M) as sigle

                                     FROM MATERIEL,SOUS_TYPE_MATERIEL

                                     WHERE MATERIEL.Id_STM=SOUS_TYPE_MATERIEL.Id_STM

                                     AND MATERIEL.Id_M='".$_SESSION['ID']."'";
	$text2="SELECT Libellecourt_TM

                                     FROM MATERIEL,SOUS_TYPE_MATERIEL,TYPE_MATERIEL

                                     WHERE SOUS_TYPE_MATERIEL.Id_TM=TYPE_MATERIEL.Id_TM

                                     AND MATERIEL.Id_STM=SOUS_TYPE_MATERIEL.Id_STM

                                     AND MATERIEL.Id_M='".$_SESSION['ID']."'";

     echo " ID matériel : ".$_SESSION['ID']." &nbsp &nbsp &nbsp Sigle matériel :".ValChamp($Connexion,$text1)." &nbsp &nbsp &nbsp Type matériel :".ValChamp($Connexion,$text2);

         //Affiche Sous Type numéro d'ordre en modif
if($mode=="modification")
	{

	     echo "<br> <br> Sous Type : ";

	     $selection=ValChamp($Connexion,"SELECT Libellecourt_STM

		                             FROM SOUS_TYPE_MATERIEL,MATERIEL

		                             WHERE MATERIEL.Id_STM=SOUS_TYPE_MATERIEL.Id_STM

		                             AND MATERIEL.Id_M='".$_SESSION['ID']."'");

	     $sql="SELECT Id_STM,Libellecourt_STM

		   FROM SOUS_TYPE_MATERIEL";

	     $resultat=resultat($sql,$Connexion);

	     ListeOption($resultat,1,"Sous type",1,$selection); 
	}
?>

  <p>

  <p>

  <? //Marque et Model de la fiche

     echo " Modèle : ". ValChamp($Connexion,"SELECT Libelle_MA

                                                     FROM MATERIEL,MARQUE

                                                     WHERE MATERIEL.Id_MA=MARQUE.Id_MA

                                                     AND Id_M='".$_SESSION['ID']."'");

     echo " / ".ValChamp($Connexion,"SELECT Model_M

                                     FROM MATERIEL

                                     WHERE Id_M='".$_SESSION['ID']."'");

     echo "  &nbsp - &nbsp Equipement pal : ". ValChamp($Connexion,"SELECT Libelle_MA

                                                     FROM MATERIEL,MARQUE

                                                     WHERE MATERIEL.Id_MA_Equip=MARQUE.Id_MA

                                                     AND Id_M='".$_SESSION['ID']."'");

  ?>

  <p>

  <p>

  </td>

</tr>

</table>

<div class=soussoustitre>
Carte grise
</div>
<?
     echo "<table border=0 align=\"center\"><br>";
    //Immatriculation de la fiche

     echo "<tr><td> Immatriculation : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT Immatriculation_M

                                                            FROM MATERIEL

                                                            WHERE Id_M='".$_SESSION['ID']."'")."\" 								    name=\"immatriculation\">";
    //mise en circulation

     echo "</td><td>&nbsp &nbsp Mise en Circulation : <input type=\"text\" value= \"".ValChamp($Connexion,"SELECT 
								convert(char(10),Misecirculation_M,103)
								FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\" 									name=\"miseencirculation\">";     
     echo "</td></tr><tr>";
    //num serie

     echo " <td>Numéro de série : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT numserie_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"numeroserie\">";     
     //puissance

     echo "</td><td>&nbsp &nbsp Puissance : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT puissance_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"puissance\">"; 
     echo "</td></tr><tr>";
     //nbplace
     echo "<td>Nombre place : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT nbplace_M

                                                            FROM MATERIEL

                                                            WHERE Id_M='".$_SESSION['ID']."'")."\"
							    name=\"nbplace\">";

    //nbplcell

     echo "</td><td>&nbsp &nbsp Nombre place cellule : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT nbplcell_m
                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"nbplacecellule\">";  
     echo "</td></tr><tr>";
    //PV

     echo "<td>PV : <input type= \"text\" value=\"".ValChamp($Connexion,"SELECT PV_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"pv\">"; 
    //PTAR

     echo "</td><td>&nbsp &nbsp PTotal : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT PTAR_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"ptotal\">";
     echo "</td></tr><tr>";
    //PTRA

     echo "<td>PTotal remorque : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT PTRA_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"ptotalremorque\">";
    //co2

     echo "</td><td>&nbsp &nbsp CO2 : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT co2_M

                                                            FROM MATERIEL

                                                            WHERE Id_M='".$_SESSION['ID']."'")."\"
							    name=\"co2\">";
    echo "</td></tr><tr>";
    //dateachat

     echo "<td>Date achat : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT dateachat_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"dateachat\">";  
    //model

     echo "</td><td>&nbsp &nbsp Modele : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT model_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"model\">"; 
     echo "</td></tr><tr>"; 
    //genre

     echo "<td>Genre : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT genre_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"genre\">"; 
    //typecg

     echo "</td><td>&nbsp &nbsp Type CG : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT typecg_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"typecg\">";
    echo "</td></tr><tr>";
    //carosserie

     echo "<td>Carosserie : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT carrosserie_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"carrosserie\">";
    //etat

     echo "</td><td>&nbsp &nbsp Etat : <input type=\"text\" value=\"".ValChamp($Connexion,"SELECT etat_m

                                                           FROM MATERIEL WHERE Id_M='".$_SESSION['ID']."'")."\"
							   name=\"etat\">";
     echo "</td></tr></table>";
?>
<br>
<div class=soussoustitre>
Renseignements techniques
</div>
<?
//Tableau des renseignements techniques du matériel - possibilité de modifier les données

     	$sql="SELECT renseignement_materiel.Id,renseignement_materiel.Id_RT,libelle_rt,libelle_rt,qte_rt_m_pf,ref_pf,libelle_pf

        FROM materiel, renseignement_materiel, renseignement_technique, piece_et_fourniture

        WHERE renseignement_materiel.id_pf= piece_et_fourniture.id_pf
	AND materiel.Id_M=renseignement_materiel.id_m
	AND renseignement_materiel.id_rt=renseignement_technique.id_rt
	AND materiel.Id_M='".$_SESSION['ID']."'

        ORDER BY renseignement_materiel.Id ASC";

     	$resultat = resultat($sql,$Connexion);
	//Requête liste de tout les renseignements pour la liste déroulante

     	$sqlliste="SELECT Id_RT,Libelle_RT

        FROM RENSEIGNEMENT_TECHNIQUE";
	//Affiche le tableau

     	echo tableaumodif($resultat,6,$sqlliste,$Connexion,
	"2 renseignement","renseignement","id","Renseignement","Quantite","Reference","Libelle piece");
	if ($mode=="modification")
	{
		//bouton ajouter et supprimer ligne renseignements		
		echo "<table width=100%><tr><td align=\"right\"><input type=\"submit\" value=\"AJOUTER LIGNE\" 
		name=\"AJOUTMATREF\"  class=\"bouton_form2\">";

      		echo "<input type=\"submit\" value=\"SUPPRIMER LIGNE\" name=\"SUPPRIMMATREF\" class=\"bouton_form2\">
		</td></tr></table><p>";
	}
?>
<br>
<div class=soussoustitre>
Equipements
</div>
<?
//Tableau des equipements du matériel - possibilité de modifier les données

     	$sql="SELECT composition_equipement.Id_e,libellecourt_fe,libellecourt_fe,libellecourt_e, libellelong_e,
 	libelle_ma, numinv_e_m

        FROM materiel, equipement, famille_equipement, composition_equipement, marque

        WHERE materiel.Id_M='".$_SESSION['ID']."'
	AND materiel.Id_M=composition_equipement.id_m
	AND composition_equipement.id_e=equipement.id_e
	AND equipement.id_fe= famille_equipement.id_fe
	AND equipement.id_ma= marque.id_ma

        ORDER BY composition_equipement.Id_e ASC";
     	$resultat = resultat($sql,$Connexion);
	//Requête liste de tout les renseignements pour la liste déroulante

     	$sqlliste="SELECT Id_E,Libellecourt_E

        FROM EQUIPEMENT";

     	//Affiche le tableau

     	tableaumodif($resultat,5,$sqlliste,$Connexion,
	"1 type","equipement","Type","Libelle","Precision","Marque","Inventaire");
	//bouton ajouter et supprimer ligne renseignements	
	if ($mode=="modification")
	{
		echo "<table width=100%><tr><td align=\"right\"><input type=\"submit\" value=\"AJOUTER LIGNE\" 
		name=\"AJOUTMATEQ\"  class=\"bouton_form2\">";

      		echo "<input type=\"submit\" value=\"SUPPRIMER LIGNE\" name=\"SUPPRIMMATEQ\" class=\"bouton_form2\">
		</td></tr></table><p>";
	}
?>
<br>
<div class=soussoustitre>
Affectations
</div>
<?
     //Tableau des réparations du matériel - possibilité de modifier les données
      $sql="SELECT Id_AF, convert(char(10),Dateaffect_AF,103)as Dateaffect_AF ,Commentaire_AF,Id_CIS,Id_SV

      FROM AFFECTATION

      WHERE Id_M='".$_SESSION['ID']."'";

      $resultat=resultat($sql,$Connexion);

      echo "<p><p><p><p><div align=\"center\"><table border><tr>";

      echo "<tr><th>Date Affectation</th><th>Commentaire</th><th>Centre</th><th>Service</th><tr>";

      if($mode=="modification")
	{
		while ($row =& $resultat->fetchRow())//Affiche les lignes du tableau

    			{

          			echo "<tr>";

          			echo "<td align=\"center\">";

          			echo "<input type=\"text\" value=\"".$row[1]."\">"; //Date affectation

          			echo "</td>";

          			echo "<td align=\"center\">";

          			echo "<input type=\"text\" value=\"".$row[2]."\">";//Commentaire

          			echo "</td>";

          			$sql2="SELECT Nom

             			    FROM Centre

            			    WHERE IDCentre='".$row[3]."'";

         			$centre=ValChamp($Connexion2,$sql2);

          			echo "<td align=\"center\">";

          			echo "<input type=\"text\" value=\"".$centre."\">";//centre

          			echo "</td>";

          			$sql3="SELECT Nom

          			       FROM Service

          			       WHERE IDService='".$row[4]."'";

          			$service=ValChamp($Connexion2,$sql3);

          			echo "<td align=\"center\">";

          			echo "<input type=\"text\" value=\"".$service."\">"; //Service

          			echo "</td>";

        			echo "</tr>";

    			}
	}
	else
	{
		while ($row =& $resultat->fetchRow())//Affiche les lignes du tableau

    			{

          			echo "<tr>";

          			echo "<td align=\"center\">";

          			echo $row[1]; //Date affectation

          			echo "</td>";

          			echo "<td align=\"center\">";

          			echo $row[2];//Commentaire

          			echo "</td>";

          			$sql2="SELECT Nom

             			    FROM Centre

            			    WHERE IDCentre='".$row[3]."'";

         			$centre=ValChamp($Connexion2,$sql2);

          			echo "<td align=\"center\">";

          			echo $centre;//centre

          			echo "</td>";

          			$sql3="SELECT Nom

          			       FROM Service

          			       WHERE IDService='".$row[4]."'";

          			$service=ValChamp($Connexion2,$sql3);

          			echo "<td align=\"center\">";

          			echo $service."&nbsp"; //Service

          			echo "</td>";

        			echo "</tr>";
		}
	}

    echo "</TABLE></DIV>";
?>
<br>
<div class=soussoustitre>
Reparations
</div>
<?
     //Tableau des réparations du matériel

     $sql="SELECT Id_RE,Resume_RE, convert(char(10),Date_RE,103)as Date_RE

           FROM REPARATION_ET_ENTRETIEN

           WHERE REPARATION_ET_ENTRETIEN.Id_M='".$_SESSION['ID']."'

           ORDER BY Id_RE DESC";

     $resultat = resultat($sql,$Connexion);

     //Affiche le tableau

     Tableau($resultat,1,3,"reparation","ID Réparation","Résumé","Date","Action");
?>
<br>

<div class=soussoustitre>
Divers
</div>
  <? //Divers - boutons
     if(($mode=="modification")&&droit(15,$_SESSION['nom'])=='oui') //droit de modifier la fiche materiel
		echo "<input type=\"submit\" value=\"ENREGISTRER\" name=\"ENREGISTRERMAT\"> ";
     if(droit(26,$_SESSION['nom'])=='oui') //droit d imprimer la fiche materiel
		echo "<input type=\"submit\" value=\"IMPRIMER\" name=\"IMPMAT\" > ";
     if ((basename($_SERVER['HTTP_REFERER']))==("fichereparation.php"))
		{echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='fichereparation.php'\" name=\"2\">";}
	else
		{echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='fichemateriel.php?ID=".$ID."'\" name=\"2\">";}
     //echo "<input type=\"button\" value=\"RETOUR\" onClick=\"self.location.href='listemateriel.php'\" name=\"2\">";

    ?>

<A NAME="bas">

</div>

</form>

</body>

</html>


modifier.php
<html>

<head>

<title>Modifier</title>

</head>

<body>

<?

include_once("confsite.php");

session_start();

$ID=$_GET['ID'];

$type=$_GET['type'];

$_SESSION['ID']=$ID;

if ($type=="reparation")

{

	echo "<script language=\"javascript\">

	window.location=\"fichereparation.php?mode=modification\";

	</script>";

}
if ($type=="materiel")
{
	echo "<script language=\"javascript\">

      window.location=\"fichemateriel.php?mode=modification\";

      </script>";
}

?>

</body>

</html>


voilà pour le moment :)
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
t'es revenu ? après c'est moi la feigneante :p
0
Anonimus
 
Ouah la tartine que t'as mise ! oO
Je vais regarder ça.

(Je commence à 14h moi :D )
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
roh tas que 3 pages :p
jen ai encore une dixaine
0
Anonimus
 
En fait sur la page listereparation.php, tu consulte toute les réparations de tous les matériels.
Chaque réparation de cette page renvoi sur fichereparation.php, avec les détails de cette réparation.

De l'autre coté tu as listemateriel.php où il y a tous les materiels.
Chaque matériel de cette page renvoi sur fichemateriel.php avec les détails de ce matériel et la possibilité de consulter les réparations qu'il a eut.

C'est çà ? :)
0
LiLou LiLa Messages postés 330 Statut Membre 12
 
uep :p
0