par
sadeq » 16 mai 2006, 16:41
j'ai essayé avec ton code, mais ça ne maffiche rien du tout, j'ai une page blanche, avec le code modifier grace a vos commentaires j'ai plus que le probleme avec la liste deroulante qui se reinitialise.
onChange="document.location.href='grcpt2.php?matgc=' + this.options[this.selectedIndex].value;">";
J'ai effacé par erreur un
print ($ld), tu dois pouvoir le remettre à sa place.
Ou bien je te le fait, tiens :
<html>
<head>
<title>Les grands comptes</title>
<script language="javascript">
function choisir(truc, truc2, truc3, truc4)
{
window.opener.document.enreg.mat.value= truc;
window.opener.document.enreg.gc.value= truc2;
self.close();}
</script>
<style type="text/css">
<!--
.Style1 {font-family: Tahoma}
-->
</style>
</head>
<body>
<span class="Style1">
<?php
include_once("connexion.php");
?>
</span>
<p align="left" class="Style1"> </p>
<form name="enreg" method="GET" >
<?php
$Req = mysql_query("SELECT nom_gc, matricule_gc FROM grand_compte where nom_gc<>''ORDER BY nom_gc");
//Le nom de la liste est matgc, onChange le matricule sera envoyé dans $_GET["matgc"]
$ld = "<SELECT NAME='matgc' onChange='enreg.submit();'>";
$ld .= "<OPTION VALUE=0>Choisissez</OPTION>";
// On boucle sur la table
// + sélectionner l'option déjà choisie
while ( $row = mysql_fetch_array($Req)) {
$nom = $row["nom_gc"];
$mat = $row["matricule_gc"];
$option_selected = ($_GET["matgc"] && $mat == $_GET["matgc"]) ? " SELECTED " : "";
$ld .= "<OPTION VALUE='$mat' $option_selected>$nom</OPTION>";
}
$ld .= "</SELECT>";
//Afficher la liste
print ($ld);
?>
</form>
<?php
if ($_GET["matgc"]) { ?>
<p align="left" class="Style1"> </p>
<p class="Style1"></p>
<p class="Style1"></p>
<table width="100%" border="1">
<tr align="center" valign="middle">
<td width="9%" class="Style1">Matricule du site </td>
<td width="17%" class="Style1">Adresse</td>
<td width="6%" class="Style1">Code postal </td>
<td width="21%" class="Style1">Ville</td>
</tr>
<?php
// on crée la requête SQL
//+ Filtrage par matgc reçu de la liste des matricules
$reqsql2 = mysql_query("SELECT `lieux`.`matricule_lieux`, `lieux`.`ad_rue_lieux`, `cp_ville`, `ville`, `nom_gc`, lieux.site
from `lieux`, `ville`, `grand_compte`
where `grand_compte`.`matricule_gc`=`lieux`.`matricule_gc`
and `lieux`.`code_ville`=`ville`.`code_ville`
and `lieux`.`matricule_gc`='$grcpt' order by `ville`
and `grand_compte`.`matricule_gc` = '$_GET[matgc]'
");
while ($rep = @mysql_fetch_object($reqsql2)) {
$mat = $rep->matricule_lieux;
$ad = $rep->ad_rue_lieux;
$cp = $rep->cp_ville;
$vil = $rep->ville;
$gc = $rep->nom_gc;
$sit= $rep->site;
?>
<tr align="center" valign="middle">
<td class="Style1"><a href="#" onClick="javascript:choisir('<?php echo $mat; ?>' , '<?php echo $gc; ?>' , '<?php echo $ad." ".$cp." ".$vil ?>', '<?php echo $sit; ?>' )" ><?php echo $mat; ?></a></td>
<td class="Style1"><?php echo $ad ?></td>
<td class="Style1"><?php echo $cp ?></td>
<td class="Style1"><?php echo $vil ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
<div align="center" class="Style1"></div>
</body>
</html>
[quote="sabine45"]j'ai essayé avec ton code, mais ça ne maffiche rien du tout, j'ai une page blanche, avec le code modifier grace a vos commentaires j'ai plus que le probleme avec la liste deroulante qui se reinitialise.
[php]onChange="document.location.href='grcpt2.php?matgc=' + this.options[this.selectedIndex].value;">"; [/php][/quote]
J'ai effacé par erreur un [b]print ($ld)[/b], tu dois pouvoir le remettre à sa place.
Ou bien je te le fait, tiens :
[php]
<html>
<head>
<title>Les grands comptes</title>
<script language="javascript">
function choisir(truc, truc2, truc3, truc4)
{
window.opener.document.enreg.mat.value= truc;
window.opener.document.enreg.gc.value= truc2;
self.close();}
</script>
<style type="text/css">
<!--
.Style1 {font-family: Tahoma}
-->
</style>
</head>
<body>
<span class="Style1">
<?php
include_once("connexion.php");
?>
</span>
<p align="left" class="Style1"> </p>
<form name="enreg" method="GET" >
<?php
$Req = mysql_query("SELECT nom_gc, matricule_gc FROM grand_compte where nom_gc<>''ORDER BY nom_gc");
//Le nom de la liste est matgc, onChange le matricule sera envoyé dans $_GET["matgc"]
$ld = "<SELECT NAME='matgc' onChange='enreg.submit();'>";
$ld .= "<OPTION VALUE=0>Choisissez</OPTION>";
// On boucle sur la table
// + sélectionner l'option déjà choisie
while ( $row = mysql_fetch_array($Req)) {
$nom = $row["nom_gc"];
$mat = $row["matricule_gc"];
$option_selected = ($_GET["matgc"] && $mat == $_GET["matgc"]) ? " SELECTED " : "";
$ld .= "<OPTION VALUE='$mat' $option_selected>$nom</OPTION>";
}
$ld .= "</SELECT>";
//Afficher la liste
print ($ld);
?>
</form>
<?php
if ($_GET["matgc"]) { ?>
<p align="left" class="Style1"> </p>
<p class="Style1"></p>
<p class="Style1"></p>
<table width="100%" border="1">
<tr align="center" valign="middle">
<td width="9%" class="Style1">Matricule du site </td>
<td width="17%" class="Style1">Adresse</td>
<td width="6%" class="Style1">Code postal </td>
<td width="21%" class="Style1">Ville</td>
</tr>
<?php
// on crée la requête SQL
//+ Filtrage par matgc reçu de la liste des matricules
$reqsql2 = mysql_query("SELECT `lieux`.`matricule_lieux`, `lieux`.`ad_rue_lieux`, `cp_ville`, `ville`, `nom_gc`, lieux.site
from `lieux`, `ville`, `grand_compte`
where `grand_compte`.`matricule_gc`=`lieux`.`matricule_gc`
and `lieux`.`code_ville`=`ville`.`code_ville`
and `lieux`.`matricule_gc`='$grcpt' order by `ville`
and `grand_compte`.`matricule_gc` = '$_GET[matgc]'
");
while ($rep = @mysql_fetch_object($reqsql2)) {
$mat = $rep->matricule_lieux;
$ad = $rep->ad_rue_lieux;
$cp = $rep->cp_ville;
$vil = $rep->ville;
$gc = $rep->nom_gc;
$sit= $rep->site;
?>
<tr align="center" valign="middle">
<td class="Style1"><a href="#" onClick="javascript:choisir('<?php echo $mat; ?>' , '<?php echo $gc; ?>' , '<?php echo $ad." ".$cp." ".$vil ?>', '<?php echo $sit; ?>' )" ><?php echo $mat; ?></a></td>
<td class="Style1"><?php echo $ad ?></td>
<td class="Style1"><?php echo $cp ?></td>
<td class="Style1"><?php echo $vil ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
<div align="center" class="Style1"></div>
</body>
</html>
[/php]