Ah oui, j'ai vu mon après merci de m'aider.
J'importe le code pour que d'autres en profitent
Celui-ci permet d'afficher les infos sur la même page après avoir
actionné le bouton "ok"
<div class="connect2" >
<strong>
<h2>Liste de départements </h2>
<form method="post" id="post" action="liste_employe.php">
<table border="0" cellspacing="2" cellpadding="3">
<tr>
<td>Numéro département:</td>
<td>
<td>
<?php
require_once '../lib/oracle_connexion.php';
// verifions si la table existe vraiment
$sql1="SELECT DEPTNO FROM EMP group by DEPTNO ";
$sql_statement = oci_parse($php_ora_connexion,$sql1);
// execution de la requete
oci_execute($sql_statement);
// extraction des donnees
echo '<select size=1 name="DEPTNO">'."\n";
echo '<option >--liste département--</option>'."\n";
while($data = oci_fetch_array($sql_statement, OCI_ASSOC+OCI_RETURN_NULLS))
{
$option = "<option value='".$data['DEPTNO']."'>".$data['DEPTNO']." </option>"."\n";
echo $option;
}
echo '</select>'."\n";
?>
</td>
<td>
<input type="submit" name="afficher" id="afficher" value="O K">
<input type="hidden" name="cache" id="afficher" >
</td>
</tr>
</table>
</form>
</strong>
<?php
// CETTE PARTIE AFFICHERA LES DONNEES
// LORSQUE LES INFOS SONT VERIFIEES
if (isset($_POST['afficher']) and isset($_POST['cache']) and isset($_POST['DEPTNO'])){
$posdept = $_POST['DEPTNO'];
require_once '../lib/oracle_connexion.php';
// LES REQUETES
$query = "SELECT EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM FROM EMP WHERE DEPTNO='$posdept' ";
// ENVOIE DES DONNEES
$parse = oci_parse($php_ora_connexion, $query);
// EXECUTION DE LA REQUETE
oci_execute($parse);
echo '<table border="0" >
<tr bgcolor="yellow">
<td colspan="7">
<strong><em>LISTING DES EMPLOYES</em></strong></td>
</tr>
<tr bgcolor="blue">
<td>NUMERO</td>
< td>DESIGNATION</td>
<td>POSTE OCCUPE</td>
<td>MGR</td>
<td>PERIODE</td>
<td>GAIN EMPLOYE</td>
<td>PRIME</td>
</tr>';
// boucle pour afficher le tableau
while ($nb_ligne = oci_fetch_array($parse, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>";
foreach ($nb_ligne as $ligne){
echo "<td>" . ($ligne !== null ? htmlentities($ligne, ENT_QUOTES) : "") . "</td>";
}
}
echo "</tr>";
echo "</table>";
}
?>
</div>
Adaptez le à votre besoin
Le second est basé sur deux formulaires et à travers un choix dans le select vous afficher l'élément sélectionné et son contenu alors adaptez le selon votre besoin
Form1: L'élément à sélectionné
liste2_employe.php
<form method="post" id="post" action="liste3_employe.php">
<table border="0" cellspacing="2" cellpadding="3">
<tr>
<td>Numéro département:</td>
<td>
<td>
<?php
require_once '../lib/oracle_connexion.php';
// verifions si la table existe vraiment
$sql1="SELECT DEPTNO FROM EMP group by DEPTNO ";
$sql_statement = oci_parse($php_ora_connexion,$sql1);
// execution de la requete
oci_execute($sql_statement);
// extraction des donnees
echo '<select size=1 name="DEPTNO">'."\n";
echo '<option >--liste département--</option>'."\n";
while($data = oci_fetch_array($sql_statement, OCI_ASSOC+OCI_RETURN_NULLS))
{
$option = "<option value='".$data['DEPTNO']."'>".$data['DEPTNO']." </option>"."\n";
echo $option;
}
echo '</select>'."\n";
?>
</td>
<td>
<input type="submit" name="afficher" id="afficher" value="O K">
<input type="hidden" name="cache" id="afficher" >
</td>
</tr>
</table>
Form2: affiche, et l'élément et son contenu
liste3_employe.php
<table border="0" cellspacing="2" cellpadding="3">
<tr>
<td>Numéro département:</td>
<td>
<select size=1 name="DEPTNO">
<option >
--------
<?php
require_once '../lib/oracle_connexion.php';
echo $posdept = $_POST['DEPTNO']; ?>
--------
</option>
</select>
</td>
</tr>
</table><br/>
<?php
// CETTE PARTIE AFFICHERA LES DONNEES
// LORSQUE LES INFOS SONT VERIFIEES
if (isset($_POST['afficher']) and isset($_POST['cache']) and isset($_POST['DEPTNO'])){
$posdept = $_POST['DEPTNO'];
require_once '../lib/oracle_connexion.php';
// LES REQUETES
$query = "SELECT EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM FROM EMP WHERE DEPTNO='$posdept' ";
// ENVOIE DES DONNEES
$parse = oci_parse($php_ora_connexion, $query);
// EXECUTION DE LA REQUETE
oci_execute($parse);
echo ' <table border="0" >
<tr bgcolor="yellow">
<td colspan="7"><strong><em>LISTING DES EMPLOYES</em></strong></td>
</tr>
<tr bgcolor="blue">
<td>NUMERO</td>
<td>DESIGNATION</td>
<td>POSTE OCCUPE</td>
<td>MGR</td>
<td>PERIODE</td>
<td>GAIN EMPLOYE</td>
<td>PRIME</td>
</tr>';
// boucle pour afficher le tableau
while ($nb_ligne = oci_fetch_array($parse, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>";
foreach ($nb_ligne as $ligne){
echo "<td>" . ($ligne !== null ? htmlentities($ligne, ENT_QUOTES) : "") . "</td>";
}
}
echo "</tr>";
echo "</table>";
}
?>